MPMoviePlayerController multitasking issue

I am developing an application on iphone that uses MPMoviePlayerController to play an audio file. When the application goes into the background, if mpmovieplayer is playing, the iphone continues to play the current music, but when it ends, the next track does not start.

I am trying to run the next audio file in MPMoviePlayerPlaybackDidFinishNotification, and when I follow the code using the debugger, I see that the method is being called and the code is executed, the bit of the next sound file still does not start.

Is this possible on iOS 4.1 or is this a limitation?

Regards Samantha

+4
source share
3 answers

You should read Technical Q & A QA1668 : How to play audio in the background using MPMoviePlayerController.

A brief description of the necessary steps:

  • announce that your application supports background execution for audio
  • Assign an appropriate category to your audio facility (the default category is not appropriate)
+2
source

I earned by putting the following two lines in the Delegate file:

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; [[AVAudioSession sharedInstance] setActive: YES error: nil]; 
+2
source

You may forget to add this to

  - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; } 
0
source

All Articles