Pregunta

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

¿Fue útil?

Solución

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.

Otros consejos

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

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top