I am working on an iPhone(Swift) app and I have a WebView which loads a Youtube video and I would like to allow landscape mode only when the video is full screen. My whole app is portrait and rotation is disabled when the video is not playing in full screen. I don't want the user to be able to rotate the app to landscape when the youtube video is not in full screen, only when the video is playing in full screen.
I tried the following code, but it doesn't work.
override func supportedInterfaceOrientations() -> Int {
return Int(UIInterfaceOrientationMask.Portrait.rawValue)
}