I using MPMediaPlayerController and i need hide elements of UI permanently. But i can see it when player start play video, 2 seconds later it hide. I using:
setControlStyle:MPMovieControlModeHidden
.
player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://catholictvhd-lh.akamaihd.net/i/ctvhd_1@88148/index_3_av-p.m3u8"]];
[player.view setFrame:self.view.bounds];
player.view.backgroundColor = [UIColor blueColor];
player.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
CGSize maxSize;
if([[UIScreen screens]count] > 1) {
[self logIt:@"External screen is available"];
newwindow = [[UIWindow alloc] init];
// There is a external display.
UIScreenMode *maxScreenMode;
for(int i = 0; i < [[[[UIScreen screens] objectAtIndex:1] availableModes]count]; i++)
{
UIScreenMode *current = [[[[UIScreen screens]objectAtIndex:1]availableModes]objectAtIndex:i];
if(current.size.width > maxSize.width)
{
maxSize = current.size;
maxScreenMode = current;
}
}
UIScreen *external = [[UIScreen screens] objectAtIndex:1];
external.currentMode = maxScreenMode;
[self logIt:[NSString stringWithFormat:@"%@",maxScreenMode]];
newwindow.screen = external;
// setting external display size.
CGPoint point = CGPointMake(0.0f, 0.0f);
//CGSize size = CGSizeMake(1024.0f, 768.0f);
CGSize size = maxSize;
CGRect frame = player.view.frame;
frame.origin = point;
frame.size.width = size.width;
frame.size.height = size.height;
[player.view setFrame:frame];
[player setControlStyle:MPMovieControlModeHidden];
[player setFullscreen:YES animated:YES];
player.shouldAutoplay = YES;
[player prepareToPlay];
[player play];
Before playing the video you have to add subview as MPMoviePlayerController
Add this line before play