I'm working on a music app for Ubuntu Touch

I don't know how to keep playing music when my app is in the background or the screen is turned off. Apparently, media-hub is a platform service introduced to allow this.

However, I couldn't find any docs about media-hub. Right now I just use the QtMultimedia.MediaPlayer to start/stop/… playback, and that automagically allows my app to keep playing the current song, even after switching to a different app.

Now I still need to fix switching to a different song after playback of the current song has finished. My implementation for this feature currently appears to be identical to the one used in the official music-app: Connect a slot to MediaPlayer's "statusChanged"-Signal to check if the status is "EndOfMedia". Then update .source and play() the next track. This works on the desktop and when the app is active on the phone. If the app is not active or the screen is turned off, I must switch back to my app in order for the playback to continue tough.

See this for the music-app implementation, line 222: http://bazaar.launchpad.net/~music-app-dev/music-app/remix/view/head:/Player.qml#L222

Now I wonder why this appears to work for music-app but fails in my app. Maybe music-app still has the lifecycle exception introduced in 2013? Or is there anything I missed?


<nik90> jhodapp: hey, I wanted to ask about the status of playlist support in media-hub.

<nik90> jhodapp: we have a couple of 3rd party music apps that are looking to add playlist support and can't do so without it

<w-flo> jhodapp, I wanted to ask the same :)

<jhodapp> nik90, it's at the top of my list to finish up most likely for our next iteration, so maybe starting on it in about 2 weeks

So music-app still uses a lifecycle exception, but some patience should help with this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.