Swift WebKit 画中画 [英] Swift WebKit Picture in Picture

查看:23
本文介绍了Swift WebKit 画中画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在来自 WebKit 的 Swift WebView 上启用画中画?

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

此时,当您在 webView 中观看视频并切换到主屏幕时,您会在主屏幕的右上角短暂看到画中画视图,但一秒钟后它就消失了.

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?

提前致谢!

推荐答案

确保您在 Xcode 的 BackgroundModes 下启用了画中画.

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

目标 ->签约&能力 ->后台模式

如果您尝试在 webView 中嵌入 YouTube 视频,画中画将无法工作.Youtube 在 iOS webView 和 Safari 中阻止画中画.

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

对于 youtube 视频嵌入最好使用 youtube-ios-player-helper 框架.

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

这篇关于Swift WebKit 画中画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆