how to set device orientation in swift 4
var isStarted:Bool! func returnedOrientation() ->AVCaptureVideoOrientation { var videoOrientation: AVCaptureVideoOrientation! let orientation = UIDevice.current.orientation switch orientation { case .unknown: break case .portrait: videoOrientation = .portrait case .portraitUpsideDown: videoOrientation = .portraitUpsideDown case .landscapeLeft: videoOrientation = .landscapeRight case .landscapeRight: videoOrientation = .landscapeLeft case .faceUp: break case .faceDown:break } return videoOrientation } @IBAction func btnRecordVideoClicked(_ sender: Any) { if isStarted == false { isStarted = true //self.sartTimer() movieOutput.connection(with: AVMediaType.video)?.videoOrientation = returnedOrient