Explorar el Código

微信自动播放

赵启卫 hace 2 años
padre
commit
a78ec81e1f
Se han modificado 1 ficheros con 16 adiciones y 3 borrados
  1. 16 3
      application/wap/view/first/special/task_info.html

+ 16 - 3
application/wap/view/first/special/task_info.html

xqd
@@ -271,10 +271,23 @@
                     vm.player.on('canplaythrough', vm.onPlayerCanplaythrough);
                     vm.player.on('ended', vm.handleEnded);
                     vm.player.on('timeupdate', vm.handleTimeupdate);
-                    document.addEventListener('WeixinJSBridgeReady',() => {
-                        alert('aaa');
-                        if (vm.player) vm.player.play();
+                    if (window.WeixinJSBridge) {
+                        window.WeixinJSBridge.invoke('getNetworkType', {}, (res) => {
+                        vm.player.load()
+                        setTimeout(() => {
+                            vm.player.play()
+                        }, 300)
                     })
+                    } else {
+                        document.addEventListener('WeixinJSBridgeReady',() => {
+                        vm.player.load()
+                        setTimeout(() => {
+                            vm.player.play()
+                        }, 300)
+                        //if (vm.player) vm.player.play();
+                    })
+                    }
+                    
 
                     // 进度条拖拽开始,不可以前进,可以后退
                     let start = true;