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.
Asked
Active
Viewed 1,484 times
2

Doug Smith
- 29,668
- 57
- 204
- 388
-
Please explain yourself, what is your real needs to help you, best regards – Reinier Melian Jul 14 '17 at 19:59
-
@ReinierMelian Your answer worked, you just didn't specify the necessary frame change. – Doug Smith Jul 14 '17 at 20:00
-
Ok, undeleted then, I will check the frame change and the issue of interaction disabled – Reinier Melian Jul 14 '17 at 20:10
1 Answers
5
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

budiDino
- 13,044
- 8
- 95
- 91

Reinier Melian
- 20,519
- 3
- 38
- 55
-
Doesn't work at all for me. Leaves white on the top and bottom and disables interaction. – Doug Smith Jul 14 '17 at 19:49
-
-
@DougSmith check my answer again, was edited, let me know if solves your problem now, best regards – Reinier Melian Jul 14 '17 at 20:36