Remote control and iOS audio session
Remote control and iOS audio session
- Subject: Remote control and iOS audio session
- From: Beinan Li <email@hidden>
- Date: Wed, 26 Jun 2013 15:09:07 -0400
Hello CoreAudio,
My app needs to handle a remote-control case:
- My app uses kAudioSessionCategory_PlayAndRecord or kAudioSessionCategory_AmbientSound category and needs to mute other apps (kAudioSessionProperty_OverrideCategoryMixWithOthers set to FALSE)
- If another app, e.g., built-in music player, is playing audio before my app starts, their audio gets muted when my app starts.
- When user tries to control their other audio apps (e.g., the music player), they can do so by using the remote-control either through double-clicking home button then swiping to the transport, or by the earbud control.
Here is my problem, it seems that my app lost audio when user pauses/resumes their music app and it's not clear why and I have no way to bring back my app's audio.
I first tried to register callbacks to listen to the properties kAudioSessionProperty_AudioRouteChange and kAudioSessionProperty_OtherAudioIsPlaying, the first one is not always triggered and the second one simply cannot be registered with a listener (which in itself was surprising because I thought all AudioSession properties are listenable).
Then I tried to handle Remote-Control Event in my app, and then pass the message to the nextResponder. This worked to the point that my app did not lose audio at all but the music player stopped receiving the remote-control events so it beats the purpose.
I wonder what would be the right way to define and detect such a scenario and safely control both my app and the other apps without losing audio from any one?
Thanks a lot!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden