NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString * documentsDirectory = [paths objectAtIndex:0]; NSString * pathVideo = [documentsDirectory stringByAppendingPathComponent:@ "MyVideo.mp4"];
NSURL * movieURL = [NSURL fileURLWithPath:pathVideo]; self.moviePlayer = [[MPMoviePlayerController alloc] init]; [self.moviePlayer setShouldAutoplay:YES]; [self.moviePlayer setContentURL:movieURL.absoluteURL]; [self.moviePlayer setMovieSourceType:MPMovieSourceTypeFile]; [self.moviePlayer setControlStyle:MPMovieControlModeDefault]; [self.moviePlayer setFullscreen:NO]; [self.moviePlayer setScalingMode:MPMovieScalingModeNone]; self.moviePlayer.view.frame = CGRectMake(40,40,240,350); [self.view addSubview:self.moviePlayer.view]; [self.moviePlayer prepareToPlay]; [self.moviePlayer play];