I want to rotate video playback using AVPlayer. Is there any way to rotate it 90 degrees clockwise?
Here is the code:
self.player = AVPlayer(URL: NSURL(fileURLWithPath: dataPath)) playerLayer = AVPlayerLayer.init(player: self.player) playerLayer.frame = view.bounds playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill view.layer.addSublayer(playerLayer) player.play()
UPDATE
It works:
self.player = AVPlayer(URL: NSURL(fileURLWithPath: dataPath)) playerLayer = AVPlayerLayer.init(player: self.player) playerLayer.setAffineTransform(CGAffineTransformMakeRotation(CGFloat(M_PI)) playerLayer.frame = view.bounds playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill view.layer.addSublayer(playerLayer) player.play()
ios rotation swift avfoundation orientation
mafioso
source share