Using this code to allow the media players to rotate in landscape (which is not supported by the app) while they are in fullscreen :
// handle orientation for the device
func application (_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
guard let vc = (window?.rootViewController?.presentedViewController) else {
return .portrait
}
if (vc.isKind(of: NSClassFromString("AVFullScreenViewController")!)) || (vc.isKind(of: NSClassFromString("YTPlayerView")!)) {
return .allButUpsideDown
} else {
return .portrait
}
}
working fine in ios 10 but since ios 11 the screen will not rotate back after leaving fullscreen, thus not resizing the UI (the app will after rotation occupy only half of the screen). It seems there were some modification on avkit but I cannot find any resources on this, thoughts?