使用声音启用视频自动播放

发布于 2025-02-09 11:37:33 字数 1309 浏览 4 评论 0 原文

我已经在HTML中使用Sound Works启用视频启用视频搜索了很多。

事实是,当 autoplay 之后是 muted 属性时,自动播放的工作正常。

我有这个视频,并且本来可以自动播放,而没有用户交互( Controls ),并且可以打开声音。

//start condition (jquery)

    //$('video').removeAttr('muted');
    
//end condition
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div>
  <video class="childhood-img" muted="muted" autoplay="autoplay" loop="loop" playsinline="playsinline" type="video/mov" src="https://www.youtube.com/watch?v=MDLn5-zSQQI" >
  </video>
</div>

我的傻瓜是,如何启用自动播放在没有上的声音和的情况下没有控制 abrutter?

I've searched a lot on how to enable video autoplay with sound works in the html.

The thing is, when the autoplay is followed by muted attribute, the autoplay works just fine.

I have this video, and was suppose to autoplay, without user interaction(controls) and with sound on.

//start condition (jquery)

    //$('video').removeAttr('muted');
    
//end condition
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

<div>
  <video class="childhood-img" muted="muted" autoplay="autoplay" loop="loop" playsinline="playsinline" type="video/mov" src="https://www.youtube.com/watch?v=MDLn5-zSQQI" >
  </video>
</div>

My dout is, how can enable autoplay, with sound on and without controls abritute?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一杆小烟枪 2025-02-16 11:37:33

如果没有用户与页面进行交互,则不再使用声音自动播放。浏览器供应商禁用了此功能,因为它惹恼了很多人,并且在工作环境中并不安全。

有趣的ressource: httpps://jamonserrano.github.github.io/state-oio/state-of-autoplay/

Having autoplay with sound is not possible anymore without an user interacting with the page. Browser vendors disabled this feature because it annoyed a lot of people and it was not safe in working environments.

Interesting ressource: https://jamonserrano.github.io/state-of-autoplay/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文