html5-video - 如何在 HTML5 视频上禁用画中画模式

标签 html5-video

如何禁用 画中画 html5 视频模式?

Please note I'm not referring to this question which relates to Apple's AVKit



我知道您可以使用 controlsList="nodownload" 禁用视频下载,怎么可能画中画模式。

<video controls controlsList="nodownload">
  <source src="https://www.w3schools.com/html/mov_bbb.ogg" type="video/mp4">
  <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/ogg">
</video>

最佳答案

按照规范在 https://wicg.github.io/picture-in-picture/#disable-pip ,
控制它的属性是 disablePictureInPicture

<video controls disablePictureInPicture controlsList="nodownload">
  <source src="https://www.w3schools.com/html/mov_bbb.ogg" type="video/mp4">
  <source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/ogg">
</video>

通过javascript实现相同的目标:
<video id="vid" controls muted>
<source src="https://www.w3schools.com/html/mov_bbb.mp4">
</video>
<script>
vid=document.getElementById("vid")
vid.disablePictureInPicture = true
</script>

关于html5-video - 如何在 HTML5 视频上禁用画中画模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54458516/

相关文章:

html - Chrome 不会在我的 Windows 计算机上显示我的 HTML 5 视频(我有 Divx)

html - HTML5视频是否可以将嵌入在mp4文件中的字幕作为轨道播放?

javascript - HTML5 视频、提示点和停止点

html5-video - 可以将 HTML5 <video> 显示为全屏背景吗?

全屏模式下的 Android HTML5 视频

html5-video - HTML5 视频 - 自动选择正确的分辨率

javascript - 如何使用 javascript 缓冲/预加载 html5 视频

javascript - 如何在没有视频控件的情况下使用 Dash.js

arrays - Video.js - 如何在一个页面中引用多个视频?

css - Chrome : Having an HTML5 video position: fixed or absolute causes all background-attachment: fixed to break