iPhone 4.0:Audio not playing in the background?
I have ported an iPhone application fr开发者_如何学JAVAom iPhone 3.0 to support now in iOS 4.0. In this application, it does playing an audio file streaming. With the iPhone 3.0 app version, when playing streaming audio if i quit my app by pressing Home button, it will stop the audio too. This is expected. In this latest my app version with iOS 4.0, if i quit my application when audio is playing by pressing Home button, i don't see playing the audio continuously in the background though i exited to home screen. Do i need to handle anything extra to play audio even after exit by pressing Home button? (or) is it still not supported in iOS 4.0 too? I use AudioToolBox to play audio files in queue based streaming.
Please advise.
Thank you.
You need to add this to your Info.plist:
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
use this category if your using an audio session or avAudioPlayer
1.AVAudioSessionCategoryPlayback or 2. kAudioSessionCategory_MediaPlayback
精彩评论