首页 > 解决方案 > 为什么html音频自动播放不起作用

问题描述

这是窃听还是什么?请帮我。我正在编写一个网站,但它不起作用。我使用谷歌浏览器。是否存在兼容性问题?

<audio autoplay id="myaudio" allow="autoplay">
<source src="http://soundbible.com/mp3/Fuse Burning-SoundBible.com-1372982430.mp3.mp3" type="audio/mpeg">
</audio>
<script> document.getElementById('myaudio').play(); </script>

标签: javascripthtml

解决方案


看起来您在 中的 URL 不起作用。删除一个 .mp3,它应该适合你。

<audio autoplay id="myaudio" allow="autoplay">
<source src="http://soundbible.com/mp3/Fuse Burning-SoundBible.com-1372982430.mp3" type="audio/mpeg">
</audio>
<script> document.getElementById('myaudio').play(); </script>


推荐阅读