Video orientation after launched from UIWebView

2019-07-22 19:41发布

I have an UIWebView that has an youtube's embed code (iframe). I'd like to enable both portrait and horizontal orientation for the video player, but portrait mode only for the UIWebView itself.

How can I achieve this?

1条回答
smile是对你的礼貌
2楼-- · 2019-07-22 20:23

The UIWebView displays its content by its orientation. There is no (easy) way to conditionally change which orientations the UIWebView allows based on its content. The only way I can imagine this working is by parsing the HTML of the web view and based on its content, allowing or disallowing certain orientations.

Regardless of all this, I would suggest either allowing both portrait and landscape for both, or only allowing portrait. This would be confusing to users if you only sometimes allowed landscape.

查看更多
登录 后发表回答