如何隐藏Safari中的画中画(PiP)控件 [英] How to hide only Picture in Picture (PiP) control from safari
问题描述
我只需要隐藏Safari浏览器中的一个视频控件,即画中画(PiP)。有什么解决方案吗?
I need to hide only one video control from safari browser which is Picture in Picture (PiP). Is there is any solution for that ?
我们可以使用HTML5隐藏它吗?
Can we hide this using HTML5?
推荐答案
没有似乎是任何官方的方式...
There doesn't seem to be any official way to do it...
目前在Safari中它是全有或全无的(带有 controls = false
)。
Currently in Safari it's all or nothing (with controls=false
).
shadow-targetting伪元素选择器似乎无法在此浏览器上运行,即使我找到了 :: - webkit的引用互联网上的-media-controls-picture-in-picture-button
。
The shadow-targetting pseudo elements selectors doesn't seem to work on this browser, unlike on Blink browsers, and even though I found references of an ::-webkit-media-controls-picture-in-picture-button
on the Internet.
所以对于今天,唯一的解决方案是禁用视频元素的所有默认控件并构建自己的控件。
如果您愿意,可以使其成为条件:
So for today, the only solution is to disable all the default controls of your video element and to build you own controls.
If you wish, you can make it conditional though:
if(typeof vidElem.webkitSupportsPresentationMode === 'function' &&
vidElem.webkitSupportsPresentationMode('picture-in-picture') ) {
vidElem.controls = false;
buildCustomControls(vidElem);
}
对于未来,那里可能一个 controlsList
属性,草稿规格目前只处理 nodownload
, nofullscreen
和 noremoteplayback
,但我不知道为什么 nopicture-in-picture
无法在那里出现,如果这个属性(主要是由Blink浏览器推动) ,再次)退出草稿。
For the future, there might a controlsList
attribute, which drafts specs currently only handles nodownload
, nofullscreen
and noremoteplayback
, but I can't see why a nopicture-in-picture
couldn't make its way there, if this attribute (mainly motivated by Blink browsers, once again) ever gets out of the drafts.
这篇关于如何隐藏Safari中的画中画(PiP)控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!