2016-10-17 61 views
5

旋转设备不会旋转当前正在播放的视频。它在iOS 8和9中效果很好。WKWebView仅在iOS 10环境模式下播放视频

在WebKit中找不到可能导致此行为的任何更改。我只是用常规配置实例化一个WKWebView。

有谁知道可能是什么原因造成的?

+0

任何这运气?我看到了同样的问题。 – sinewave440hz

+1

没有运气 修正了当我知道视频正在播放时,将应用程序的方向定义为风景。然后,当它结束时,强制应用程序再次以纵向模式显示。 一个非常冒险的解决方案,会喜欢更合适的解决方案。 – ivopintodasilva

+1

@ivopintodasilva关心分享如何强制将其设置在横向上后旋转回肖像?我似乎无法强迫我回到肖像。 – Teffi

回答

0

在AppDelegate中

func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { 

    if let presentedViewController = window?.rootViewController?.presentedViewController { 
     let className = String(describing: type(of: presentedViewController)) 
     if ["MPInlineVideoFullscreenViewController", "MPMoviePlayerViewController", "AVFullScreenViewController"].contains(className) 
     { 
      return UIInterfaceOrientationMask.allButUpsideDown 
     } 
    } 

    return UIInterfaceOrientationMask.portrait 
}