# 激活自动播放视频中的音频

**URL:** <https://meta.discourse.org/t/activate-audio-in-autoplay-video/179638>\
**Category:** Support\
**Created:** [2021年二月14日 08:43 UTC](https://meta.discourse.org/t/activate-audio-in-autoplay-video/179638 "2021-02-14T08:43:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PaulinaMX](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paulinamx/32/210473_2.png) [@PaulinaMX](https://meta.discourse.org/u/PaulinaMX)\
**Post date:** [2021年二月14日 08:43 UTC](https://meta.discourse.org/t/activate-audio-in-autoplay-video/179638/1 "2021-02-14T08:43:17Z")

</div>

你好，我在登录页面上使用了一段视频，代码如下：

```html
<video width="100%" controls autoplay loop>
     <source src="https://forosmx.s3-us-west-2.amazonaws.com/Portada+forosmx.mp4" type="video/mp4">
</video>

```

一切运行正常，但我希望音频能自动播放，而不需要用户手动从控制栏开启。您可以访问 `www.forosmx.com` 查看效果。

请帮帮我，谢谢！

---

<div class="post-metadata">

**Author:** ![Benjamin\_D](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/benjamin_d/32/277831_2.png) [@Benjamin\_D](https://meta.discourse.org/u/Benjamin_D)\
**Post date:** [2021年二月14日 11:56 UTC](https://meta.discourse.org/t/activate-audio-in-autoplay-video/179638/2 "2021-02-14T11:56:58Z")

</div>

我认为目前出于礼仪考虑，自动播放功能默认是静音的。

> <https://github.com/discourse/discourse/blob/7fe536871873c911a1a5a6f006408c1579909563/app/assets/javascripts/pretty-text/addon/sanitizer.js#L129-L133>

---

<div class="post-metadata">

**Author:** ![PaulinaMX](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paulinamx/32/210473_2.png) [@PaulinaMX](https://meta.discourse.org/u/PaulinaMX)\
**Post date:** [2021年二月14日 20:59 UTC](https://meta.discourse.org/t/activate-audio-in-autoplay-video/179638/3 "2021-02-14T20:59:19Z")

</div>

谢谢，你说得对，如果我移除自动播放，音频就会被激活。

有没有办法修改这一点，还是这是默认行为？

> [@Benjamin\_D](#):
>
> 我认为目前出于礼仪考虑，自动播放时默认是静音的。  
> [discourse/app/assets/javascripts/pretty-text/addon/sanitizer.js at 7fe536871873c911a1a5a6f006408c1579909563 · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/7fe536871873c911a1a5a6f006408c1579909563/app/assets/javascripts/pretty-text/addon/sanitizer.js#L129-L133)

---

<div class="post-metadata">

**Author:** ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)\
**Post date:** [2021年二月14日 21:30 UTC](https://meta.discourse.org/t/activate-audio-in-autoplay-video/179638/4 "2021-02-14T21:30:16Z")

</div>

如今，带声音的自动播放几乎无法实现。有关更多背景信息，请参阅 [Blog &nbsp;|&nbsp; Chrome for Developers](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes%E3%80%82)

---

<div class="post-metadata">

**Author:** ![PaulinaMX](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paulinamx/32/210473_2.png) [@PaulinaMX](https://meta.discourse.org/u/PaulinaMX)\
**Post date:** [2021年二月14日 21:48 UTC](https://meta.discourse.org/t/activate-audio-in-autoplay-video/179638/5 "2021-02-14T21:48:10Z")

</div>

> [@michaeld](#):
>
> 如今，带声音的自动播放几乎无法实现。有关更多背景信息，请参阅 [自动播放策略变更 | Web | Google 开发者](https://developers.google.com/web/updates/2017/09/autoplay-policy-changes)。

非常感谢，我只是想确认一下是否可行，但如果无法实现，也没关系。

谢谢大家。

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)\
**Post date:** [2021年三月16日 21:48 UTC](https://meta.discourse.org/t/activate-audio-in-autoplay-video/179638/6 "2021-03-16T21:48:51Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
