AVPlayerViewController

AVPlayerViewController

本文介绍了在AVPlayerViewController中将视频旋转90度-可以吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何在 AVPlayerViewController 中将视频旋转90度,有人对如何执行此操作有任何想法吗?我不确定如何像往常一样访问 AVPlayerLayer .

I cannot figure out how to rotate the video 90 degrees in AVPlayerViewController, anyone have any ideas as to how to do this? I'm unsure how to access the AVPlayerLayer as you normally would.

推荐答案

尝试使用此代码,使用AffineTransform旋转视图,但我们还需要调整框架

Try with this code, using AffineTransform we rotate the view but we need also adjust the frame

已编辑

UIView.animate(withDuration: 0.5) {
  self.avPlayerViewController?.view.transform = CGAffineTransform(rotationAngle: CGFloat((90 * Double.pi)/180))
  self.avPlayerViewController?.view.frame = CGRect(x: 0, y: 0, width: (self.avPlayerViewController?.view.frame.size.height)!, height: (self.avPlayerViewController?.view.frame.size.width)!)
}

工作正常,已经过测试

希望这对您有帮助

这篇关于在AVPlayerViewController中将视频旋转90度-可以吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-15 08:43