I have vidoe playing in landscape mode. And the view only rotate between landscapeLeft and landscapeRight when the device orientation changes. That's to say there is no portrait mode when playing the movie. What's more apart from the movie view, other views are portraint mode, so the app config is portrait. How can I make the movie view only rotate in the landscape mode.
Here is a part of my code.
appdelegate,
internal var shouldRotate = false
func application(_ application: UIApplication,
supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return shouldRotate ? .allButUpsideDown : .portrait
}
movie view controller,
let appDelegate = UIApplication.shared.delegate as! AppDelegate
appDelegate.shouldRotate = true // or false to disable rotation
let value = UIInterfaceOrientation.landscapeLeft.rawValue
UIDevice.current.setValue(value, forKey: "orientation")
For now the problem is that the movie view can be protrait when orientation changes.
Change
.allButUpsideDown
to.landscape