Does MPMoviePlayerController show a blank white screen before starting?

I have an MPMoviePlayerController which I represent modally. The video loads fine, but before starting the video, the screen turns white until it loads. How can I prevent this?

moviePlayerViewController = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:mySTVideo.video_url]]; [self presentModalViewController:moviePlayerViewController animated:YES]; 
+4
source share
2 answers

First you should use this to display movies:

 [self presentMoviePlayerViewControllerAnimated:moviePlayerViewController]; 

Secondly, to change the background of moviePlayerViewController, you can use:

 moviePlayerViewController.view.backgroundColor = [UIColor blackColor]; 

So, when the video starts, the background color will be black.

Hope this helps ...

+7
source

In addition, you must set movieSourceType to MPMoviePlayercontroller (which you can access through moviePlayerViewController.moviePlayer ).

If you do not set this property, by default it will be MPMovieSourceTypeUnknown , and the player will not display the controls until the request returns (which may take some time on WWAN ).

+9
source

Source: https://habr.com/ru/post/1314021/


All Articles