1、midijs
参考:http://www.midijs.net/
<html>
<head>
<title>MIDI.js Autoplay example</title>
<script type='text/javascript' src='//www.midijs.net/lib/midi.js'></script>
</head>
<h1>Autoplaying hinematov.mid ...</h1>
<div>Reload page to start again. Note: This does not work for some browsers (iOS, Chrome version 71ff),
i.e. in this case you will not hear anything.</div>
<p>
<a href="#" onClick="MIDIjs.play('midi/test.mid');">Play hinematov.mid</a>
<a href="javascript:MIDIjs.stop()">Stop playing</a>
</body>
</html>
值得注意的是,高版本chrome无法播放,且无法使用非用户触发的函数,如<body onload=”MIDIjs.play('midi/test.mid');
“>,无法触发事件。
2、
将mid转换为mp3,使用
<audio class="zlsec-audio" controls="controls" autoplay="autoplay">
<source src="./mp3/test.mp3" type="audio/mpeg" />
</audio>