djcouchycouch
djcouchycouch

Reputation: 12832

Playing fullscreen video on iPhone without any user controls or interaction?

I'm working on an iOS game that has an intro video. How do I play the video full screen without:

1) user controls like play/pause being visible

2) touches like double-tap or pinching changing the video's scale/zoom?

To disable taps on the video, can I just add a blank UIView overtop of the movie player view? How would I do that?

Upvotes: 1

Views: 2786

Answers (3)

Vivek Sehrawat
Vivek Sehrawat

Reputation: 6570

MPMoviePlayerViewController *playerViewController=[[MPMoviePlayerViewController alloc]initWithContentURL:[NSURL fileURLWithPath:[[NSBundle mainBundle]pathForResource:@"XYZ" ofType:@"mp4"]]];
[self presentViewController:playerViewController animated:NO completion:nil];

MPMoviePlayerController *player = [playerViewController moviePlayer];
player.controlStyle=MPMovieControlStyleNone;   //hide the controls
[player play];

Upvotes: 0

djcouchycouch
djcouchycouch

Reputation: 12832

I went with adding a "blank" view overtop the MPMoviePlayerController. This is how I set it up. Didn't have to mess with event handlers.

mBlankView = [[UIView alloc] initWithFrame:viewFrame];
mBlankView.userInteractionEnabled = YES;
[mBlankView setMultipleTouchEnabled:YES];
[mBlankView setBackgroundColor:[UIColor clearColor]];
[window addSubview:mBlankView];    

viewFrame contains the size of the MPMoviePlayerController.

Upvotes: 1

pkoning
pkoning

Reputation: 384

What kind of movie player are you using? If you're using MPMoviePlayerViewController/MPMoviePlayerController you can set the controlStyle property to MPMovieControlStyleNone. (If you use MPMoviePlayerViewController you first call the moviePlayer property so you get the MPMoviePlayerController which has the controlStyle property)

Example:

MPMoviePlayerViewController* moviePlayerViewController = [MPMoviePlayerViewController alloc] initWithContentURL:url];
moviePlayerViewController.moviePlayer.controlStyle = MPMovieControlStyleNone;

Upvotes: 5

Related Questions