简体   繁体   English

在 AVPlayerViewController 中调整视频大小

[英]Resize video within AVPlayerViewController

Is there any way to resize and/or reposition the video displayed within an AVPlayerViewController?有什么方法可以调整和/或重新定位在 AVPlayerViewController 中显示的视频? I want to do this to support zooming.我想这样做以支持缩放。 I know it can be done when using AVPlayerLayer, but have found no way to do it with AVPlayerViewController.我知道它可以在使用 AVPlayerLayer 时完成,但找不到使用 AVPlayerViewController 来完成的方法。 Changing the bounds of AVPlayerViewController's view, or placing AVPlayerViewController within a UIScrollView don't work, of course, because the entire view resizes, including the built-in controls.更改 AVPlayerViewController 视图的边界,或将 AVPlayerViewController 放置在 UIScrollView 内当然是行不通的,因为整个视图都会调整大小,包括内置控件。

Or a more general question: any way to support pinch zoom on AVPlayerViewController?或者更一般的问题:有什么方法可以支持 AVPlayerViewController 的缩放? (I want full zoom, not just switch to and from fullscreen mode.) (我想要完全缩放,而不仅仅是切换全屏模式。)

It's not ideal, but I ended up doing this: to zoom in, I adjusted _playerViewController.view.frame, and set _playerViewController.showsPlaybackControls to YES.这并不理想,但我最终这样做了:为了放大,我调整了 _playerViewController.view.frame,并将 _playerViewController.showsPlaybackControls 设置为 YES。 So when zoomed in, you dont' see the player controls.因此,当放大时,您看不到播放器控件。 That was the best I could come up with.那是我能想到的最好的。 But probably better to just write your own player controller.但最好只编写自己的播放器 controller。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM