I have a MPMoviewPlayerViewController
embedded into an UIView
object. When I start the player in the embedded mode everything works fine and as exp
My WORKING solution:
I had the same issue, when I try to play video it stops immediately after a second with logs:
[MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
I solved it putting stop command just before play command:
[playerController stop];
[playerController play];
Now it works perfect!
Are you stopping the video in viewWillDisappear:
or viewDidDisappear:
? Those methods get called when a video enters fullscreen on iOS 6, but not on any earlier iOS versions (a report has been filed at Open Radar for this "bug"). I posted this temporary solution on a similar question:
My temporary solution until the bug is fixed is to check the player's fullscreen
Boolean value in viewWillDisappear:
and/or viewDidDisappear:
. If it returns YES
, the movie is entering fullscreen mode and you should refrain from doing anything that might interrupt it.
The solution is create a property to retain the MPMoviePlayerController class
@property (nonatomic, retain) MPMoviePlayerController *moviePlayerController;
and use the property in your controller
self.moviePlayerController = [[MPMoviePlayerController alloc] init];
[_viewMediaPlayer addSubview:self.moviePlayerController.view];
there is a bug in iOS6 and the MPMoviePlayerController is deallocated when entry in fullscreen mode http://openradar.appspot.com/12327997
So for me this solution worked:
if( !( player.playbackState == MPMoviePlaybackStatePlaying ) ) {
player.shouldAutoplay = YES;
[player prepareToPlay];
[player stop];
[player play];
}
adding both "shouldAutoplay" and "stop"
Regards, Eliza
Another way of dealing with this is to use the full screen notification callback:
1) Add a notification for the movie player MPMoviePlayerDidEnterFullscreenNotification. 2) Before you play the movie, set a boolean indicating that the movie is entering fullscreen. 3) Clear the boolean to NO in your full screen callback as well as your movie finished call back. 4) In your viewWillDisappear, check if your boolean to see if your movie is entering full screen, and handle as needed.
Also when presenting an MPMoviePlayerViewController, using the setFullScreen function after presenting can cause the movie to stop on iOS6.