I have a MPMoviePlayerController that plays a video embedded within a View. This worked perfectly on iOS5/5.1 etc... but since upgrading to iOS6 this has stopped working and now the view is just black. Does anyone have any ideas or similar issues?
Thanks
Try this one......
NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"ddd" ofType:@"mp4"];
NSURL *url = [NSURL fileURLWithPath:resourcePath];
MPMoviePlayerViewController *moviePlayer = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
moviePlayer.view.frame = CGRectMake(0, 0, 500, 500);
moviePlayer.moviePlayer.shouldAutoplay=YES;
moviePlayer.moviePlayer.controlStyle = MPMediaTypeMusicVideo;
[moviePlayer.moviePlayer setFullscreen:YES animated:YES];
[self.view addSubview:moviePlayer.view];
[moviePlayer.moviePlayer play];
I was access to the same problem, and finally finding that the key line "[player prepareToPlay]" missing. in iOS5 it does no matters, but in iOS6 it lead to a black screen;
MPMoviePlayerController *player =
[[MPMoviePlayerController alloc] initWithContentURL: myURL];
[player prepareToPlay];
[player.view setFrame: myView.bounds]; // player's frame must match parent's
[myView addSubview: player.view];
// ...
[player play];
Actually, MPMediaTypeMusicVideo is defined as MPMediaType, below is the definition:
MPMediaTypeMusicVideo = 1 << 11, (2048)
Is it the undocumented thing?