質問

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. :)

役に立ちましたか?

解決

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.

他のヒント

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

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top