Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMoviePlayerController shows blank white screen before launch?

I have an MPMoviePlayerController that I am presenting modally. The video loads fine, however just before the video is launched the screen turns white until it has loaded. How can I prevent this from happening?

moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:mySTVideo.video_url]];

[self presentModalViewController:moviePlayerViewController animated:YES];
like image 325
Sheehan Alam Avatar asked Dec 05 '22 02:12

Sheehan Alam


2 Answers

Also, you should make sure to set the movieSourceType on your MPMoviePlayercontroller (which you can access via moviePlayerViewController.moviePlayer).

If you don't set this property, it defaults to MPMovieSourceTypeUnknown, and the player won't show controls until the request has returned (which can take a while on WWAN).

like image 167
Michael Grinich Avatar answered Mar 01 '23 22:03

Michael Grinich


First, you should be using this for display the movies:

[self presentMoviePlayerViewControllerAnimated:moviePlayerViewController];

Second, to change the moviePlayerViewController background you can use:

moviePlayerViewController.view.backgroundColor = [UIColor blackColor];

So when the video is launched the background color will be black.

Hope its helps...

like image 28
JP Illanes Avatar answered Mar 01 '23 23:03

JP Illanes