Swift WebKit Picture in Picture

谁说胖子不能爱 提交于 2021-02-08 06:36:35

问题


How can you enable Picture-in-Picture on a Swift WebView from WebKit?

At the moment, when you watch a video in a webView and switch to the home screen, you briefly see the picture-in-picture view in the top right on the home screen, but it disappears after a second.

How can you retain it so it doesn't disappear?

Thanks in advance!


回答1:


Make sure you enabled Picture in Picture under BackgroundModes in Xcode.

TARGETS -> Signing & Capabilities -> Background Mode

If you are trying to embed a youtube video in your webView, PiP won't work. Youtube blocking PiP in iOS webView and Safari.

For youtube videos embedding is better to use the youtube-ios-player-helper framework.



来源:https://stackoverflow.com/questions/65270507/swift-webkit-picture-in-picture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!