Rotate video 90 degrees in AVPlayerViewController - possible?

落爺英雄遲暮 提交于 2021-01-27 20:58:24

问题


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.


回答1:


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

EDITED

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)!)
}

Work just fine, was tested

Hope this helps you



来源:https://stackoverflow.com/questions/45110393/rotate-video-90-degrees-in-avplayerviewcontroller-possible

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!