Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
560 views
in Technique[技术] by (71.8m points)

华为手机浏览器使用Video.js无法自动播放

华为浏览器中Video.js无法自动播放 只能靠用户操作controls
以下是创建的代码

 <video poster="__STATIC__/m-image/pic_m_index_helpwork.png" data-setup="{'autoplay':true}" muted loop="loop" type="video/mp4" autoplay  id="video-player" preload="auto" class="video-js vjs-big-play-centered" playsinline="true" webkit-playsinline="true">
    <source src="./aaa.mp4"  type="video/mp4" />
 </video>
 var iPlayHeight = (document.body.clientWidth) / 1.7777
 var player = videojs('video-player', {
    autoplay: true,
    width:document.body.clientWidth,
    height:iPlayHeight
 }, function onPlayerReady() {
    //视频加载完成后自动播放
    setTimeout(function(){
      player.play();
    },1000)
 });

在其他手机(小米,苹果)的浏览器中都可以,但就在华为Meta10 pro中不行
Androi版本 Android10 EMUI10

已经尝试过在touchstart时执行播放代码 但还是无法自动播放

 $(window).on('touchstart', function(){
    setTimeout(function(){
      player.play();
    },1000)
 });

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...