Alex Rivera | Logout

MPMoviePlayerController showing black empty screen

Asked 2011-12-08T10:44:05.800
25

I use MPMoviePlayerController to play a local file in my Application Document folder which have I have downloaded for a server URL:

itemMoviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
 [self.view addSubview:itemMoviePlayerController.view];
 itemMoviePlayerController.fullscreen = YES;
 itemMoviePlayerController.movieSourceType = MPMovieSourceTypeFile;
 itemMoviePlayerController.initialPlaybackTime = -1.0;
 [itemMoviePlayerController play];

When I play .mov file just after I downloaded it, It shows up a black empty screen & app UI is unusable. But if play same local file next time, it plays fine. I even verified playState & localState for MPMoviePlayerController they seems fine. What could be reason for black empty screen?

Edit
Report

1 Answer

2

I had this same problem and it made me crazy. It would work on one view controller fine (audio and video), but not work on another (black screen with just audio). In the end, all I did was CHANGE THE ORDER of the calls: I simply waited until I was done configuring the movie player before adding it to the view. In other words, I called "addSubview" on the line just before the call to "play".

answered 2012-09-05T00:37:42.233

Your Answer