解决苹果safari游览器不能自动播放音乐的问题

直接贴代码:

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);  

转载:https://segmentfault.com/q/1010000008171676

猜你喜欢

转载自www.cnblogs.com/feiying100/p/9485666.html