我希望能够检测MPMoviePlayerViewController
的出现和消失标准控件。我在UIButton
上添加了MPMoviePlayerViewController
,当UIButton
控件出现和消失时,我希望显示并隐藏此MPMoviePlayerViewController
。 touchesbegan
上的touchend
和MPMoviewPlayerViewController
方法不起作用,并且MPMoviewPlayerViewController
上的手势也无效。
NSMutableString *videoUrl = [[NSMutableString alloc] initWithString:VIDEO_URL];
//[videoUrl appendString:movie.streamUrl];
[videoUrl appendString:@"almosthuman.mp4"];
[videoUrl appendString:@"/playlist.m3u8"];
NSURL *url = [NSURL URLWithString:videoUrl];
player = [[MPMoviePlayerViewController alloc] initWithContentURL:url];
[player.moviePlayer setMovieSourceType:MPMovieSourceTypeStreaming];
//[player.moviePlayer setShouldAutoplay:YES];
[player.moviePlayer setScalingMode:MPMovieScalingModeAspectFill];
NSString *subtitlesPathStr = [[NSBundle mainBundle] pathForResource:@"subtitle" ofType:@"srt"];
[player.moviePlayer openSRTFileAtPath:subtitlesPathStr
completion:^(BOOL finished) {
// Activate subtitles
[player.moviePlayer hideSubtitles];
[self presentMoviePlayerViewControllerAnimated:player];
} failure:^(NSError *error) {
NSLog(@"Error: %@", error.description);
}];
[player.moviePlayer.view addSubview:btnLanguage];
timerSessionTimeOut = [NSTimer scheduledTimerWithTimeInterval:7.5 target:self selector:@selector(hideBtnLanguage) userInfo:nil repeats:YES];