Alex Rivera | Logout

MPMoviePlayerController: How can I make my video loop?

Asked 2011-01-02T21:51:40.863
12

Thank you in advance for any help, I am a newbie and would appreciate any help here.. I have this code to play a movie and it works great. Can somebody PLEASE tell me how to make this movie loop and replay from the beginning non stop ( any code would help). Also I would like to know how to play 2 movies, one after the other, preferably with a fade or smooth transition. Thank you for any help

#import "MyAppViewController.h"

@implementation MyAppViewController

-(IBAction)button:(id)sender{
 NSString *path = [[NSBundle mainBundle]
       pathForResource:@"mymovie" ofType:@"mp4"];

 player = [[MPMoviePlayerViewController alloc]
     initWithContentURL:[NSURL fileURLWithPath:path]];

 [self presentMoviePlayerViewControllerAnimated:player];

}
Edit
Report

1 Answer

23

Set the repeatMode property of your MPMoviePlayerController to MPMovieRepeatModeOne

player = [[MPMoviePlayerViewController alloc]
          initWithContentURL:[NSURL fileURLWithPath:path]];
player.moviePlayer.repeatMode = MPMovieRepeatModeOne;
answered 2011-01-02T21:54:52.740

Your Answer