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.
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
Related
In my project, where we use pjsip2 to receive streaming audio from a shared server.
The app is meant to only receive streaming audio, not record.
However even though we have disabled the mic in out code we still get a notification of the app recording while it is in the background (top bar flashing red with text: " (recording)").
How can I disable the recording notification while our app is running in the background?
Remove the audio option from info plist for UIBackgroundModes
Example:
<key>UIBackgroundModes</key>
<string>voip</string>
Scenario: My app is running in the background. An iPhone/iPad user launches the iPod app (or Pandora or another program that plays audio) on their device and starts playing music. My app detects that that music is now playing, and records or in some way does things with the current playing audio (like stream it to a server), all while still running in the background.
Is this possible? Can anyone point me in the right direction in the SDK on how to do this?
You can't do this. And that is that.
till know, i was aware of the fact is, we cant play background process in iPhone, but with 4.0 + we can do it.
i have a doubt, suppose we develop and music player application, which need to be play audio continiously, while the application has been closed.
Is this possible.
For example, the inbuilt music player of iPhone does this, if u play an audio, and close the app, it will continue playing the audio, untill you fully close the music player.
SO my doubht is, can we play music in background, while application is closed.???
Suggestions are always appreciated
regards
Open your plist file as a plain text file and add background modes as audio.
<dict>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
// other codes
</dict>
All the Best.
I'm compiling using iOS4. When I launch my application that uses UIImagePickerController and iAds the iPod music halts and doesn't continue in the background? Any settings I have to add to my app?
Thanks
Are you playing any music or sounds from your app? If so, it will mute the iPod.
I'm making iphone program. The main function is playing video files, and recording sound.
OS 3.1.3 version is fine. But iPhone 4.0 makes problem!!
When I executed playing video (MPMoviePlayerController) and continuously recording sound (AVAudioRecorder), AVAudioRecorder doesn't work....
No recording..! ;o;
Somebody help!!
Check the useApplicationAudioSession property on MPMoviePlayerController. In iOS 3.1.x, the movie player was always getting its own system provided audio session. In iOS 4.0, it can now share the application session, and that's the default value as well. Try switching that property to NO before starting to play your movie.