Prechádzať zdrojové kódy

解决视频自动播放在移动端无效的问题

ming 1 rok pred
rodič
commit
92f0e29f4a
1 zmenil súbory, kde vykonal 11 pridanie a 1 odobranie
  1. 11 1
      index.html

+ 11 - 1
index.html

@@ -59,7 +59,7 @@
             
             <div v-if="modelType==1" style="width:100%;height:100%;background-size:cover;background-position:center center;background-repeat:no-repeat;" v-bind:style="{backgroundImage:'url('+columnImage+')'}"></div>
             
-            <video  v-else id="videoPlay"  autoplay loop muted style="width:100%;height:100%;object-fit:fill;"
+            <video webkit-playsinline="webkit-playsinline" playsinline  v-else id="videoPlay"  autoplay loop muted style="width:100%;height:100%;object-fit:fill;"
                 poster="assets/img/banner/poster.jpg">
                 <source  type="video/mp4">
             </video>
@@ -146,6 +146,16 @@
     <!--====== commonVue js ======-->
     <script type="module" src="assets/js/commonVue.js "></script>
 
+
+    <!-- //引入微信的js,以及写入以下js -->
+    <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
+    <script>
+        document.addEventListener("WeixinJSBridgeReady", function () {
+            document.getElementById("videoPlay").play();
+        }, false);
+    </script>
+
+
     </body>
 
 </html>