实际上,我的问题是,它不会自动播放歌曲(chinese.mp3)文件中的音频。我把它放在github上了。
但是,只是缺少音频。
你能帮我吗?
----我的 Memory Mania 游戏项目的链接:-
---其在线(netlify)托管链接:- 链接
<div class="music">
<audio autoplay>
<source src="./songs/chinese.mp3" type="audio/mp3" id="myaudio" />
Your browser does not support the audio element.
</audio>
</div>
<audio autoplay id="myaudio">
<source src="./songs/chinese.mp3" type="audio/mp3" allow="autoplay"/>
Your browser does not support the audio element.
</audio>
使用的js:
// --------------- auto - play --------------------
var x = document.getElementById("myaudio").autoplay;
浏览器不会直接运行音频,它就像一个保护系统,您必须激活音频,在某些浏览器(例如Firefox)中您会在搜索栏中看到图标,启用音频并享受!