简体   繁体   中英

In iOS7 MPMoviePlayer repeated mode property is not working

In iOS8 same code is working fine.But in iOS7 after completion of video its not repeated.I have used the below code

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

    moviePlayer.view.userInteractionEnabled = NO;

I am using this code for repeated working in ios7 and 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];

}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM