实现微信浏览器自动播放MP3音乐

时间:2017-01-16 11:11:43   收藏:0   阅读:469
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>MP3</title>
        <script type="text/javascript" src="http://cdn.bootcss.com/jquery/1.8.3/jquery.min.js"></script>
    </head>
    <body>
        <div style="overflow: hidden;">
            <audio src="http://oj1hxt5z0.bkt.clouddn.com/123.mp3" id="Jaudio" class="media-audio" autoplay preload loop="loop"></audio>
        </div>
        <script type="text/javascript">
            function audioAutoPlay(id){
                var audio = document.getElementById(id);
                audio.play();
                document.addEventListener("WeixinJSBridgeReady", function () {
                    audio.play();
                }, false);
                document.addEventListener(YixinJSBridgeReady, function() {
                    audio.play();
                }, false);
            }
        audioAutoPlay(Jaudio);
        </script>
    </body>
</html>

 

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