Getsy
Getsy

Reputation: 4905

iPhone 4.0:Audio not playing in the background?

I have ported an iPhone application from 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.

Upvotes: 0

Views: 341

Answers (2)

j2emanue
j2emanue

Reputation: 62519

use this category if your using an audio session or avAudioPlayer

1.AVAudioSessionCategoryPlayback or 2. kAudioSessionCategory_MediaPlayback

Upvotes: 0

Gordon Childs
Gordon Childs

Reputation: 36074

You need to add this to your Info.plist:

<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
</array>

Upvotes: 1

Related Questions