在横向模式下使用AVPlayer进行视频播放

时间:2023-01-23 23:02:04

I've a video which is being played by AVPlayer in a particular ViewController. When tapping on the Full Screen icon in the AVPlayer control bar, I want the video to be played in landscape mode in the same ViewController. I'm attaching a screenshot for this scenario.在横向模式下使用AVPlayer进行视频播放

我有一个AVPlayer在特定ViewController中播放的视频。点击AVPlayer控制栏中的全屏图标时,我希望在同一ViewController中以横向模式播放视频。我附上了这个场景的截图。

1 个解决方案

#1


1  

you just have to write the below code for orienting the view controller

你只需编写以下代码来定向视图控制器

NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];

Whenever you click the FS btn,try to orient the VC

每当您单击FS btn时,请尝试定向VC

#1


1  

you just have to write the below code for orienting the view controller

你只需编写以下代码来定向视图控制器

NSNumber *value = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeLeft];
[[UIDevice currentDevice] setValue:value forKey:@"orientation"];

Whenever you click the FS btn,try to orient the VC

每当您单击FS btn时,请尝试定向VC