You can hide your MPMoviePlayer
until that annoying black flicker is gone.
To ensure that the black flicker is gone, you can check if the MPMoviePlayer
's loadState
is 3 ( which means MPMovieLoadStatePlayable
| MPMovieLoadStatePlaythroughOK
) and playbackState
is 1 (which means MPMoviePlaybackStatePlaying
)
First hide your MPMoviePlayer
:
yourMPMoviePlayer.view.hidden = YES;
Just add an observer to be notified when loadState changes:
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(loadStateChanged:)
name:MPMoviePlayerLoadStateDidChangeNotification
object:nil];
And make your MPMoviePlayer visible again when you are notified and conditions are met:
- (void)loadStateChanged:(NSNotification *)sentNotification
{
if (player.loadState == (MPMovieLoadStatePlaythroughOK | MPMovieLoadStatePlayable) && player.playbackState == MPMoviePlaybackStatePlaying)
yourMPMoviePlayer.view.hidden = NO;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…