Hello friends

 

While trying to work on a project I had an issue of getting black screen with videos

Fixed it with a hack

 

Find the code below for that

 
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
switch (self.interfaceOrientation) {
case UIInterfaceOrientationPortraitUpsideDown:
moviePlayer.view.transform = CGAffineTransformConcat(moviePlayer.view.transform, CGAffineTransformMakeRotation(M_PI)); // 180 degrees
break;
default:
moviePlayer.view.transform = CGAffineTransformConcat(moviePlayer.view.transform, CGAffineTransformMakeRotation(0.0));
break;

}
UIWindow *backgroundWindow = [[UIApplication sharedApplication] keyWindow];
[moviePlayer.view setFrame:backgroundWindow.frame];
[backgroundWindow addSubview:moviePlayer.view];
[moviePlayer prepareToPlay];
[moviePlayer play];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinishImgHot:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayBackDidFinishImgHot:) name:MPMoviePlayerDidExitFullscreenNotification object:nil];

Hope it helps at-least some of you
Cheers🙂