MPMusicPlayerController not play on background
i am using MPMusicPlayerController in开发者_JAVA百科 my app and when i enter to background it stop playing.
this is how i add it :
musicPlayer = [MPMusicPlayerController iPodMusicPlayer];
The iPodMusicPlayer
is always enabled in the background. You shouldn't have to set anything. And [MPMusicPlayerController applicationMusicPlayer]
won't play in the background ever. I'd say you're using the wrong MPMusicPlayerController
somewhere.
You need to indicate in your app's plist file that you want to play audio in the background.
you create the applicationMusicPlayer it is not play in back ground. you have to create ipodMusicPlayer to overcome this.
check this out for further refference. http://developer.apple.com/library/ios/#documentation/MediaPlayer/Reference/MPMusicPlayerController_ClassReference/Reference/Reference.html#//apple_ref/doc/uid/TP40008221
精彩评论