Permissions-Policy: autoplay
Experimental: 这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。
The HTTP Permissions-Policy
header autoplay
directive controls whether the current document is allowed to autoplay media requested through the HTMLMediaElement
interface. When this policy is enabled and there were no user gestures, the Promise
(en-US) returned by HTMLMediaElement.play()
will reject with a DOMException
. The autoplay
attribute on <audio>
and <video>
elements will be ignored.
For more details on autoplay and autoplay blocking, see the article Autoplay guide for media and Web Audio APIs.
语法
Permissions-Policy: autoplay <allowlist>;
- <allowlist>
-
允许使用此特性的来源(origin)列表。参见
Permissions-Policy
。
默认策略
Google Chrome 的默认值是 'self'
。
规范
Specification |
---|
HTML Standard # autoplay-feature |
浏览器兼容性
BCD tables only load in the browser