<body>
<bgsound id='snd_ie' src="" loop="loop">
<object id='snd_chrome' width="0px" height="0px" type="audio/x-wav" data=""></object>
<input type="button" value="开始" οnclick="playSound()">
<input type="button" value="暂停" οnclick="stopSound()">
</body>
<script>
function playSound() {
//IE放 背景音乐
var snd_ie = document.getElementById('snd_ie');
snd_ie.src = "http://10.6.40.46:9999/records/2/voice/20170705/1051/102/20170705233723050.wav";
//chrome
var snd_chrome = document.getElementById('snd_chrome');
snd_chrome.data = "http://10.6.40.46:9999/records/2/voice/20170705/1051/102/20170705233723050.wav";
}
function stopSound() {
var snd_ie = document.getElementById('snd_ie');
snd_ie.src = ""
var snd_chrome = document.getElementById('snd_chrome');
snd_chrome.data = ""
}
</script>
搜了下firefox不支持播放wav文件,大神可以补充
转载于:https://blog.51cto.com/zifeng5966/1947614