Question

Hello i am trying to play background music with MPMusicPlayerController's applicationMusicPlayer in iOS.

I have also added Required background modes in Plist.

But it doesn't play background music.

How can i play background music with MPMusicPlayerController?

Thanks for your reading. :)

Was it helpful?

Solution

The applicationMusicPlayer does not support background music. Use MPMusicPlayerController's iPodMusicPlayer instead. It shares the state with the built-in iPod player and music will continue to play when your app enters the background.

OTHER TIPS

Bryan is right about applicationMusicPlayer not playing music in background, but there is another solution:

You can use AVAudioPlayer to play either streamed or local(bundle) audio. It even allows you to play multiple audio file at the same time having an AVAudioPlayer instance for each.

Here's the documentation: http://developer.apple.com/library/ios/#DOCUMENTATION/AVFoundation/Reference/AVAudioPlayerClassReference/Reference/Reference.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top