如何检测MPMoviePlayerViewController标准控件出现/消失

时间:2014-06-18 12:16:18

标签: ios ios7 custom-controls

我希望能够检测MPMoviePlayerViewController的出现和消失标准控件。我在UIButton上添加了MPMoviePlayerViewController,当UIButton控件出现和消失时,我希望显示并隐藏此MPMoviePlayerViewControllertouchesbegan上的touchendMPMoviewPlayerViewController方法不起作用,并且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];

0 个答案:

没有答案