문제

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