iOS background playing music - regression/discussion with ActiveAE sink
#1
This is about the feature of playing music in the background on iOS Touch Devices and controlling it via the player remote controls (to be found in the task switcher on ios < 7 or in the control center in ios 7).

Current state of the feature with our current (and deprecated) audioengine:

iOS5: Start music, kick XBMC into background (music gets paused) and go to the very left of the task switcher - the player control shows the play button (indicating that the music in XBMC is paused). Music can be paused/resumed and skipped with the controls. This works like intended.

iOS6: Start music, kick XBMC into background (music gets paused) and go to the very left of the task switcher - the player control shows the pause button (indicating that the music in XBMC is playing! - this is wrong). Music can be paused/resumed and skipped with the controls - but the play button always shows the "pause" symbol. This works mostly but has the cosmetic issue with the wrongly indicating play/pause button. (there seem to be related bugs in iOS for example see: http://stackoverflow.com/questions/10118...r-in-ios-5 )

iOS7: Start music, kick XBMC into background (music gets paused) and swipe up the control center - the player control shows the pause button (indicating that the music in XBMC is playing! - this is wrong). Music can't(!) be resumed. Music can(!) be skipped and starts playing then though. The Play button always shows the "pause" symbol and seems to do nothing. The problem in iOS7 is that the pause button doesn't send a UIEventSubtypeRemoteControlTogglePlayPause anymore. It instead only sends UIEventSubtypeRemoteControlPause and UIEventSubtypeRemoteControlPlay. See
http://stackoverflow.com/questions/19445...g-anything

The problem is, that the play/pause button always stays at "pause" this meanse that ios7 only sends UIEventSubtypeRemoteControlPause. The problem can be worked around by treating "UIEventSubtypeRemoteControlPause" like "UIEventSubtypeRemoteControlTogglePlayPause" on iOS7.

On all iOS versions the current implementation kills the gui sounds after stopping or pausing any playback (music or video doesn't matter) because this suspends the audioengine (for getting the correct "play" button on iOS5).

Current state of the feature with our new audioengine (ActiveAE) as it will be merged to mainline soon:

1. I removed the suspend of the audioengine as in the new engine nobody would start it again after pause/stop. So in that case it not only kills gui sounds - but kills the complete engine until forcing a reinit of the sink
2. Because of that - music background playing behaves like on iOS6 for iOS5 too (meaning the play/pause button always shows pause - but works feature wise).

The plan for the new audioengine is to change the background playing as follows:

1. Get rid of audiosession/interruption management in the sink (as it is handled already in UIApplication)
2. Runtimedetect iOS7 and treat UIEventSubtypeRemoteControlPause like UIEventSubtypeRemoteControlTogglePlayPause for iOS7
3. Remove all CAEFactory:Confuseduspend/CAEFactory::resume calls from UIApplication.

If i am right this should lead to the behavior from iOS6 on all other iOS versions too (can't test iOS4 though) - leaving only the cosemtic regression of the play/pause button always showing "pause". (which all people > iOS5 are experiencing already - its "only" a regression for iOS5 users).

Another thing would be to track down which call in CAEFactory::Suspend() really leads to the play/pause button switching to "play" on the current (deprecated) audioengine in iOS5. But i hadn't have time to debug this yet. (and it has low prio as it is broken by apple since ios6 anyway).

I just wanted to write my findings down so ulion can read and discuss it here (instead of using github for those lengthy texts Wink ).

@ulion - what do you say?
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply


Messages In This Thread
iOS background playing music - regression/discussion with ActiveAE sink - by Memphiz - 2014-02-20, 12:38
Logout Mark Read Team Forum Stats Members Help
iOS background playing music - regression/discussion with ActiveAE sink0