ios微信浏览器自动播放音乐

 

 

//ios自动播放音乐
function audioAutoPlay(id){
    var audio = document.getElementById(id),
        play = function(){
            audio.play();
            document.removeEventListener("touchstart",play, false);
        };
    audio.play();
    document.addEventListener("WeixinJSBridgeReady", function () {
        play();
        var a = document.getElementById('video')
        a.play()
    }, false);
    document.addEventListener('YixinJSBridgeReady', function() {
        play();
    }, false);
    document.addEventListener("touchstart",play, false);
}
audioAutoPlay('media');

 

posted on 2019-02-18 19:08  鲲跃北溟  阅读(186)  评论(0编辑  收藏  举报

导航