When I click on a picture, I show a pop-up with a video in it. In that pop up, a video is launching automatically. The problem is that I don't have interactivity with the video (play, pause, etc...). So for now, I found the way to loop it with the AVPlayerItemDidPlayToEndTimeNotification but I would like the user has the capability to play/pause. Here is my code :
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(itemDidFinishPlaying:) name:AVPlayerItemDidPlayToEndTimeNotification object:player];
NSURL *url = [NSURL fileURLWithPath:mediaPath];
player = [[AVPlayer alloc] initWithURL: url];
controller = [[AVPlayerViewController alloc] init];
controller.player = player;
controller.delegate = self;
controller.showsPlaybackControls = YES;
UIImageView *popView = [[[[[[NSBundle mainBundle] loadNibNamed:mediaType owner:self options:nil] objectAtIndex:0] viewLoadedFromXib] subviews] objectAtIndex:0];
[controller.view setFrame:CGRectMake(0, 0, 850, 600)];
[popView addSubview:controller.view];
[player play];
I precise that when I click on the video, the bar with the pause video appears below, but when I click on the button, nothing happens.
1ST EDIT: It seems that there is a AVTouchIgnoringView that has been added automatically by the AVPlayerViewController. It seems that there is a link with UserInteraction... But I try to put it to YES without success. May be I don't do it for the good view. Any ideas ?
2ND EDIT : this is the setFrame that adds the AVTouchIgnoringView. So do you know how can I change the size of the frame without it adding automatically that AVTouchIgnoringView ?