在后台播放网页中的声音文件

新手上路,请多包涵

我想在后台播放我的网页上的声音文件(不希望出现媒体播放器用户界面),我的网站将在 Fire-Fox 上运行,我使用了嵌入元素并设置了隐藏属性是的 <embed name="myMusic" src="Masgon.mp3" type="audio/midi" autostart="false" Hidden="true" loop="true"></embed> 问题是没有声音播放,除非我在这种情况下删除隐藏属性播放声音文件并出现媒体播放器用户界面,但我不希望这样。

原文由 Eslam Hamdy 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 417
2 个回答
<audio src="/music/good_enough.mp3">
<p>If you are reading this, it is because your browser does not support the audio element.     </p>
</audio>

如果你想要控制

<audio src="/music/good_enough.mp3" controls>
<p>If you are reading this, it is because your browser does not support the audio element.</p>
</audio>

并且还使用嵌入

<embed src="/music/good_enough.mp3" width="180" height="90" loop="false" autostart="false" hidden="true" />

原文由 topcat3 发布,翻译遵循 CC BY-SA 3.0 许可协议

<audio src="/music/good_enough.mp3" autoplay>
<p>If you are reading this, it is because your browser does not support the audio element.     </p>
<embed src="/music/good_enough.mp3" width="180" height="90" hidden="true" />
</audio>

对我有用。

原文由 Adrian 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题