iphoneiphone-sdk-3.0mpmovieplayercontrollermpmoviewcontroller

I Want the Video file to Play repeatedly in my application an I am using the MPMoviePlayerController to play the video file


HI Friends, I Want the Video File To Play repeatedly in my application and i have used the Following code to play the video file

NSString *tempurl = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.m4v"];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:tempurl]];
player.view.frame = CGRectMake(0, 0, 867, 1008);
player.scalingMode = MPMovieScalingModeFill;
[self.view addSubview:player.view];
[player play];

Can I Have The Delegate method that can give the alert for the video file end playing Thank You In Advance


Solution

  • you can use the property "repeatMode" and set it to MPMovieRepeatModeOne

    //Determines how the movie player repeats the playback of the movie.
    
    
    @property(nonatomic) MPMovieRepeatMode repeatMode
    
    //Discussion The default value of this property is MPMovieRepeatModeNone. 
    
       // For a list of available repeat modes, see “MPMovieRepeatMode.”
    
    // Availability Available in iOS 3.2 and later.Declared In MPMoviePlayerController.h
    
    NSString *tempurl = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Movie.m4v"];
    MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:tempurl]];
    
    player.view.frame = CGRectMake(0, 0, 867, 1008);
    
    player.scalingMode = MPMovieScalingModeFill;
    
    player.repeatMode = MPMovieRepeatModeOne;
    
    [self.view addSubview:player.view];
    
    [player play];