javascript - 为什么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>
解决方案
看起来您在 中的 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>
推荐阅读
- c# - 如何在单击一次按钮时应用多个事件
- node.js - 如果权限请求被拒绝,如何传递给意图
- css - 选择了 ng-content 的所有可能的直接子级
- android - 当应用程序在后台时,Workmanager 不工作
- maven - 带有 Maven 工件的类路径的 Jar 文件清单
- javascript - 上传到fire-base时如何降低图像质量
- jquery - jquery remove 和 addclass 在 iphone 上不起作用
- python-3.x - 我收到错误“从检查点恢复失败”。在 AI 平台(ml-engine)上训练 tensorflow estimator api 时
- excel - Excel VBA单击html div类中的项目
- c# - 创建一个“幽灵鼠标”来模拟鼠标点击