I have an audio app that uses the Media Playback audio session category to allow background audio. Once my audio session is initialized, the hardware volume buttons on the iOS device control the volume of my audio session.
Once audio playback stops, I'd like to return control of the phone ringer back to the hardware volume buttons but my attempt to do this by deactivating the audio session doesn't do the trick.
Here is how I'm initializing and activating my audio session:
AudioSessionInitialize(NULL, NULL, interruptionListenerCallback, self);
AudioSessionAddPropertyListener(kAudioSessionProperty_AudioRouteChange,
audioRouteChangeListenerCallback,
self);
UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback;
AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,
sizeof(sessionCategory),
&sessionCategory);
Here is how I'm attempting to deactivate the audio session and return control of the iOS device's ringer back to the hardware volume controls:
AudioSessionSetActive(false);
There is at least one app that I know of that behaves this way (Audible.com's iOS app). Does anyone have any idea what I may be doing wrong?
OSStatus
returned byAudioSessionSetActive(false);
? developer.apple.com/library/ios/#DOCUMENTATION/AudioToolbox/… – Godforsaken