Permissions-Policy: autoplay
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
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