I am trying to use UITapGestureRecognizer to handle the taps on my full screen video. If I omit [self.player setFullscreen:YES animated:NO]; It works, but then my video will not scale to fit the screen.
From my .m:
- (void)viewDidLoad { [super viewDidLoad]; NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mov"]; player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:videoPath]]; player.shouldAutoplay = NO; player.view.frame = self.view.bounds; player.scalingMode = MPMovieScalingModeAspectFit; player.controlStyle = MPMovieControlStyleNone; player.fullscreen = YES; self.player = player; [self.player prepareToPlay]; UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)]; UIView *aView = [[UIView alloc] initWithFrame:player.view.bounds]; [aView addGestureRecognizer:tapGesture]; [self.player.view addSubview:aView]; } - (IBAction)playMovie:(id)sender {
From my .h:
@property (retain, nonatomic) MPMoviePlayerController *player; - (void)handleTap:(UITapGestureRecognizer *)recognizer;
source share