简体   繁体   中英

Resize video within AVPlayerViewController

Is there any way to resize and/or reposition the video displayed within an 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. 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.

Or a more general question: any way to support pinch zoom on 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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