微信audio自动播放

时间:2017-12-12 21:12:59   收藏:0   阅读:195
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
</head>
<body>
<audio   id="music" src="music/music.mp3" autoplay="autoplay" loop></audio>
<script>
    audioAutoPlay1(music);
    function audioAutoPlay1(id){
        var audio = document.getElementById(id);
        audio.play();

        document.addEventListener("WeixinJSBridgeReady", function () {
            audio.play();

        }, false);
    }
</script>
</body>
</html>

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!