我有像这样的html5代码
<audio controls autoplay>
<source src="song/1.mp3" type="audio/mpeg">
<source src="song/2.mp3" type="audio/mpeg">
<source src="song/3.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
为什么它只播放最新歌3.mp3
?如何让它自动播放所有歌曲1.mp2->2.mp3->3.mp3
?
答案 0 :(得分:0)
您可以为每个音频使用单独的标记
<audio controls autoplay>
<source src="song/1.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio controls>
<source src="song/2.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<audio controls>
<source src="song/3.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
或创建一个播放列表控件,如https://www.script-tutorials.com/html5-audio-player-with-playlist/