简体   繁体   中英

iOS - AudioSession Cateogry for AudioUnit Application

I am working on streaming audio player application for iOS. currently i am experimenting with AudioQueue and AudioUnit for playback.

Both works fine in the normal condition. But I am facing an issue with AudioUnit version of app when it goes to sleep mode.

AudioUnit version of the application stopped the playback when application goes to sleep mode. Where as AudioQueue version of the application playing with out any issue during the sleep mode.

I have set "kAudioSessionCategory_MediaPlayback" session category for both cases. I assume this session category should continue the playback even in sleep mode.

I am not sure what i am missing here.

I want to add pan/effects features to my application, so i am trying with AudioUnit.

Any help is highly appreciated.

Finally i have got the AudioUnit Implementation working. I have set the AudioSession category as "kAudioSessionCategory_MediaPlayback". As i am using AudioUnit for playback, i need to set "kAudioUnitProperty_MaximumFramesPerSlice" property to 4096. so it will continue the playback even in the device is in the sleep mode.

According to Apple's documentation on audio sessions , you should probably use kAudioSessionCategory_SoloAmbientSound instead. This will stop all sounds from other applications, but that's the price you pay for being able to keep playing when the device is locked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM