获取音乐并播放:
<html>
<audio id = "music" preload = "auto"></audio>
</html>
<script>
var music_click = $("#music").[0];
$("#music")[0].play();
</script>
获取视频并播放:
<video id = "video" src = "video/video.mp4">
<script>
var video = $("#video").[0];
video.play();
</script>
暂停掉所有音乐:
function pauseAllMusic () {
var element = $("audio");
element.each(function() {
$(this)[0].pause();
});
}
来源:https://www.cnblogs.com/Iwantecho/p/11349815.html