gsabran / DDDKit

360 video player for iOS written in swift - a subset of SceneKit that works

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not able to rotate the video at 180 degree

Dev-Prem opened this issue · comments

Hi,
i found this library very useful for me. The issue i am getting is i am not able to rotate the video at 180 degree in portrait mode actually the video is upside down type and i need to rotate the video. i have changed code for DDD360VideoViewController file in setUpPlayback() function which is
`
private func setUpPlayback(for asset: AVAsset) {
let requestedKeys = [kTracksKey, kPlayableKey]
asset.loadValuesAsynchronously(forKeys: requestedKeys, completionHandler: {
DispatchQueue.main.async {
let status = asset.statusOfValue(forKey: self.kTracksKey, error: nil)
if status == AVKeyValueStatus.loaded {
self.playerItem = AVPlayerItem(asset: asset)
self.player?.replaceCurrentItem(with: self.playerItem!)
let playerLayer = AVPlayerLayer(player: self.player)
playerLayer.frame = self.view.bounds //bounds of the view in which AVPlayer should be displayed
playerLayer.videoGravity = .resizeAspectFill
playerLayer.setAffineTransform(CGAffineTransform(rotationAngle: -3.15))
playerLayer.frame = self.view.bounds
playerLayer.videoGravity = AVLayerVideoGravity.resizeAspect
self.view.layer.addSublayer(playerLayer)
self.player?.play()
}
}

    })
}`

I am attaching a screen shot of video i need to show the face from top side
image
Please help me out!

Thanx,
Prem