How could I Embedded Video in a UIView like Path?
ios, path, video
Solution
Taken from one of my projects, just adjust this to fit your needs:
NSURL *movieUrl = [NSURL fileURLWithPath:moviePath];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:movieUrl];
player.view.frame = CGRectMake(0, 0, 690, 370);
// Here is where you set the control Style like fullscreen or embedded
player.controlStyle = MPMovieControlStyleDefault;
//player.controlStyle = MPMovieControlStyleEmbedded;
//player.controlStyle = MPMovieControlStyleDefault;
//player.controlStyle = MPMovieControlStyleFullscreen;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinished) name:MPMoviePlayerPlaybackDidFinishNotification object:player];
UIView *movieBox = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 600, 400)];
[movieBox setBackgroundColor:[UIColor blackColor]];
[movieBox addSubview:player.view];
[self.view addSubview:movieBox];
player.scalingMode = MPMovieScalingModeAspectFit;
player.contentURL = movieUrl;
[player play];
Problem
the picture is snapped from Path App, u can see, In the table view,there is a video clip, when I touched on the play button, the video plays without changing to full screen. it seems the video is Embedded in the table view? How to do this? could u give a example? thanks