【问题标题】:In iOS7 MPMoviePlayer repeated mode property is not working在 iOS7 MP 电影播放器​​中,重复模式属性不起作用
【发布时间】:2015-09-21 06:53:14
【问题描述】:

在 iOS8 中相同的代码工作正常。但在 iOS7 中完成视频后它不会重复。我使用了下面的代码

    self.playerView.moviePlayer = moviePlayer;
    self.mPlayer = moviePlayer;
    self.mPlayer.repeatMode = YES;
    self.playerView.moviePlayer.view.frame = self.playerView.bounds;

    moviePlayer.view.userInteractionEnabled = NO;

【问题讨论】:

  • 将您的repeatMode 设置为MPMovieRepeatModeOne

标签: iphone ios7 mpmovieplayer


【解决方案1】:

我正在使用此代码在 ios7 和 ios8 中重复工作。

        videoPlayer = [[MPMoviePlayerController alloc]init];
        [videoPlayer setContentURL:[NSURL fileURLWithPath:vidUrl]];

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(moviePlayBackDidFinish:)
                                                     name:MPMoviePlayerPlaybackDidFinishNotification
                                                   object:videoPlayer];


        videoPlayer.controlStyle = MPMovieControlStyleNone;
        videoPlayer.shouldAutoplay = YES;
        videoPlayer.repeatMode = MPMovieRepeatModeNone;

        videoPlayer.view.frame = videoPreview.bounds;
        videoPlayer.scalingMode=MPMovieScalingModeFill;
        [videoPreview insertSubview:videoPlayer.view belowSubview:btnPlayPreview];

        [videoPlayer setFullscreen:NO animated:NO];


- (void) moviePlayBackDidFinish:(NSNotification*)notification
{
    NSLog(@"NOTIFICATION :%@", notification);

    NSLog(@">>> Movieplaydidfinish");
    MPMoviePlayerController *player = [notification object];
    [player play];

}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多