gpt4 book ai didi

iphone - 如何强制MPMoviePlayerViewController全屏显示?

转载 作者:行者123 更新时间:2023-12-01 17:41:08 25 4
gpt4 key购买 nike

谁能告诉我如何在开始播放视频后立即强制MPMoviePlayerViewController以全屏播放。我已经尝试过setFullScreen:animated:函数,但是它不起作用。那么有人可以帮助我吗?提前致谢。

另外,我仅使用应用程序捆绑包中的视频文件。

最佳答案

这解决了我的问题。

NSURL *movieUrl = [NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource:@"appVid"
ofType:@"mp4"]];
moviePlayer = [[MPMoviePlayerController alloc]initWithContentURL:movieUrl];
moviePlayer.controlStyle = MPMovieControlStyleFullscreen;
moviePlayer.scalingMode = MPMovieScalingModeAspectFill;
moviePlayer.shouldAutoplay = YES;
moviePlayer.view.frame = [[UIApplication sharedApplication]keyWindow].bounds;
[[[UIApplication sharedApplication]keyWindow] addSubview:moviePlayer.view];

[moviePlayer setFullscreen:YES animated:YES];

[moviePlayer play];

关于iphone - 如何强制MPMoviePlayerViewController全屏显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19396250/

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