zoukankan      html  css  js  c++  java
  • 微信audio自动播放(ios播放问题)

    <!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>

     ios多个音效,延迟播放

     audioAutoPlay2('music2');
    
        function audioAutoPlay2(id){
            var audio = document.getElementById(id);
            audio.play();
            setTimeout(function(){
                audio.pause();
            },100);
            document.addEventListener("WeixinJSBridgeReady", function () {
                audio.play();
                setTimeout(function(){
                    audio.pause();
                },100);
            }, false);
            document.addEventListener('YixinJSBridgeReady', function() {
                audio.play();
                setTimeout(function(){
                    audio.pause();
                },100);
    
            }, false);
        }
  • 相关阅读:
    面向对象
    ArrayList 集合
    JAVA 方法
    JAVA数组
    JAVA基础2
    JAVA基础1(语法)
    JAVA基础(jdk安装和环境变量的配置)
    数据结构练习题
    多表查询
    数据约束
  • 原文地址:https://www.cnblogs.com/xiaobaibubai/p/8028529.html
Copyright © 2011-2022 走看看