I want to play a video on a same view on a button click.
NSURL *movieUrl = @"Some Url";
CGRect frame;
frame =CGRectMake(10,10,100,100);
MPMoviePlayerViewController *player = [[MPMoviePlayerViewController alloc] initWithContentURL:movieUrl];
[self.view addSubview:player.view];
player.view.frame = frame;
[player release];
when I run this, it shows a frame with black background but does not play the video. I am not using youtube video.
NSURL* videoURL = [NSURL URLWithString:url];
MPMoviePlayerController* mPlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[mPlayer prepareToPlay];
[mPlayer play];
//For viewing partially.....
[mPlayer.view setFrame:CGRectMake(50, 200, (self.view.frame.size.width)-100 , 400)];
mPlayer.view.backgroundColor = [UIColor grayColor];
[self.view addSubview:mPlayer.view];