我只是使用 MPMoviePlayerController 播放视频...我的代码是
-(void)playMovie:(NSURL *)url
{
moviePlayer =
[[MPMoviePlayerController alloc]
initWithContentURL:url];
if (IDIOM==IPAD) {
[moviePlayer.view setFrame:CGRectMake(22,100, 720, 300)];
}
else
{
(IS_IPHONE_5)? [moviePlayer.view setFrame:CGRectMake(22, 70, 280, 150)]:[moviePlayer.view setFrame:CGRectMake(22, 40, 260, 140)];
}
[_scrollView addSubview:moviePlayer.view];
moviePlayer.scalingMode =MPMovieScalingModeFill;
[moviePlayer prepareToPlay];
[moviePlayer play];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerDidEnterFullscreen:) name:MPMoviePlayerDidEnterFullscreenNotification object:Nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(moviePlayerDidExitFullScreen:) name:MPMoviePlayerDidExitFullscreenNotification object:Nil];
}
-(void)moviePlayerDidEnterFullscreen :(id)sender
{
NSLog(@"fullscreen");
[moviePlayer play];
moviePlayer.scalingMode =MPMovieScalingModeFill;
}
- (void) moviePlayerDidExitFullScreen:(id)sender {
NSLog(@"exit full screen");
[moviePlayer play];
moviePlayer.scalingMode =MPMovieScalingModeFill;
}
在这里,当我最初播放视频时,视频将处于“MPMovieScalingModeFill”模式...但我的问题是,如果我按全屏,它会全屏显示视频..当我按退出“全屏”时,我的视频模式会转到“MPMovieScalingModeAspectFit “模式。但我需要始终处于“MPMovieScalingModeFill”模式。我的代码有什么问题。请帮助我...