MPMediaPlayerController frame problem
Actually i want to play a video in a small area of self.view but initially or first time when the video play then video's visible area occupy this small part and other black area of video goes out of the boundary of this small area. My code is
-(void)animateVideoMPMediaPlayer:(NSString *)strVideoName{
//self.navigationItem.hidesBackButton = TRUE;
// Register to receive a notification when the movie has finished playing.
NSString *path = [[NSBundle mainBundle] pathForResource:strVideoName ofType:@"mp4" inDirectory:nil];
NSURL *ur= [NSURL fileURLWithPath:path];
NSLog(@"hello %@",ur);
if(mediaPlayer)
[mediaPlayer release];
mediaPlayer = [[MPMoviePlayerController alloc] initWithContentURL:ur];
//mediaPlayer.fullscreen = YES;
//mediaPlayer.scalingMode = MPMovieScalingModeAspectFill;
videoPlayer.scalingMode=MPMovieScalingModeFill;
[mediaPlayer setControlStyle:MPMovieControlStyleNone];
//[mediaPlayer setMovieControlMode:MPMovieControlModeHidden];
mediaPlayer.view.frame = CGRectMake(4,362,102 ,100);
//mediaPlayer.view.bounds = CGRectMake(4,362,102 ,100);
[self.view addSubview:mediaPlayer开发者_StackOverflow.view];
mediaPlayer.view.frame = CGRectMake(4,362,102 ,100);
[mediaPlayer setRepeatMode:MPMovieRepeatModeOne];
[mediaPlayer play];
// [self performSelector:@selector(stopVideoPlease:) withObject:mediaPlayer afterDelay:5];
}
精彩评论