<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"> <title>video测试</title> <style> video { display: flex; } .test_video { /*height: 4.2rem;*/ margin-bottom: 1rem; } .btn{ width: 3rem; height: 1rem; border: 1px solid red; display: flex; align-items: center; justify-content: center; margin: auto; font-size: .4rem; } </style> </head> <body> <div> <!--controls="controls"--> <video id=‘videoId‘ class="test_video" width="100%" ref=‘videoRef‘ height="30%" x5-video-orientation="portraint" webkit-playsinline="true" playsinline="" x5-playsinline="" x-webkit-airplay="allow" @pause="pauseVideo" @playing=‘playIngVideo‘ src="https://www.w3school.com.cn//i/movie.ogg" preload="" style="position:inherit;width:100%;"> </video> <div onclick="csBtn()" class="btn">安卓测试播放按钮</div> </div> <script src="js/auto-size.js"></script> <script src="js/zepto.min.js"></script> <script> function csBtn(){ var doc = document.getElementById(‘videoId‘) doc.play(); doc.pause(); setTime(function(){ doc.setAttribute(‘controls‘,‘controls‘) doc.play(); },2000) } </script> </body> </html>
先播放一次,在暂停,在ajax后再播放,
原文地址:https://www.cnblogs.com/jsgg/p/12642846.html
时间: 2024-10-16 04:06:48