簡體   English   中英

在iOS7中,MPMoviePlayer的重復模式屬性不起作用

[英]In iOS7 MPMoviePlayer repeated mode property is not working

在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;

我正在使用此代碼在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];

}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM