diff options
Diffstat (limited to 'files/zh-cn/web/http/headers/feature-policy/autoplay/index.html')
-rw-r--r-- | files/zh-cn/web/http/headers/feature-policy/autoplay/index.html | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/files/zh-cn/web/http/headers/feature-policy/autoplay/index.html b/files/zh-cn/web/http/headers/feature-policy/autoplay/index.html new file mode 100644 index 0000000000..88dc07c786 --- /dev/null +++ b/files/zh-cn/web/http/headers/feature-policy/autoplay/index.html @@ -0,0 +1,52 @@ +--- +title: 'Feature-Policy: autoplay' +slug: Web/HTTP/Headers/Feature-Policy/autoplay +translation_of: Web/HTTP/Headers/Feature-Policy/autoplay +--- +<div>{{HTTPSidebar}} {{SeeCompatTable}}</div> + +<p><span class="seoSummary">The HTTP {{HTTPHeader("Feature-Policy")}} header <code>autoplay</code> directive controls whether the current document is allowed to autoplay media requested through the {{domxref("HTMLMediaElement")}} interface.</span> When this policy is enabled and there were no user gestures, the {{domxref("Promise")}} returned by {{domxref("HTMLMediaElement.play()")}} will reject with a <code>DOMException</code>. The {{htmlattrxref("autoplay", "audio")}} attribute on {{HTMLElement("audio")}} and {{HTMLElement("video")}} elements will be ignored.</p> + +<p>For more details on autoplay and autoplay blocking, see the article <a href="/en-US/docs/Web/Media/Autoplay_guide">Autoplay guide for media and Web Audio APIs</a>.</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">Feature-Policy: autoplay <可选>;</pre> + +<dl> + <dt><allowlist></dt> + <dd>{{page("Web/HTTP/Feature_Policy/Using_Feature_Policy", "allowlist")}} 默认值是<code>'self'</code>.</dd> +</dl> + +<h2 id="参考说明">参考说明</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">参考说明</th> + <th scope="col">状态</th> + <th scope="col">注解</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('Feature Policy')}}</td> + <td>{{Spec2('Feature Policy')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性支持">浏览器兼容性支持</h2> + + + +<p>{{Compat("http.headers.Feature-Policy.autoplay")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li>{{HTTPHeader("Feature-Policy")}} header</li> + <li><a href="/en-US/docs/Web/HTTP/Feature_Policy">Feature Policy</a></li> + <li><a href="/en-US/docs/Web/HTTP/Feature_Policy/Using_Feature_Policy">Using Feature Policy</a></li> +</ul> |