gpt4 book ai didi

ios - 退出全屏后 MPMoviePlayerController 缩放模式问题

转载 作者:可可西里 更新时间:2023-11-01 17:07:46 24 4
gpt4 key购买 nike

我只是使用 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”模式。我的代码有什么问题......请帮助我......

最佳答案

我相信这会生成 MPMoviePlayerScalingModeDidChangeNotification

[[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(movieScalingModeDidChange:)
name:MPMoviePlayerScalingModeDidChangeNotification
object:nil];

来源:Apple Doc

MPMoviePlayerScalingModeDidChangeNotification

当电影播放器​​的缩放模式改变时发布。没有 userInfo 字典。缩放模式可以通过编程方式或通过用户交互进行更改。要设置或检索电影播放器​​的缩放模式,请访问其 scalingMode 属性。状态已更改的电影播放器​​可用作与通知关联的对象。

关于ios - 退出全屏后 MPMoviePlayerController 缩放模式问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21024030/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com