H5中标签audio在手机端不能自动播放 在页面上加上如下代码即可
<audio id="music" autoplay="true" loop="loop" class="audioMusicBtn media-audio" controls="controls" preload src="images/music.mp3"></audio>
function audioAutoPlay(id){
var audio = document.getElementById(id),
play = function(){
audio.play();
document.removeEventListener("touchstart",play, false);
};
audio.play();
document.addEventListener("WeixinJSBridgeReady", function () {//微信
play();
}, false);
document.addEventListener(‘YixinJSBridgeReady‘, function() {//易信
play();
}, false);
document.addEventListener("touchstart",play, false);
}
audioAutoPlay(‘music‘);