如何在移动html版本上激活自动播放



我的视频在windows上完美启动,但当我在安卓智能手机上播放时,视频就不再被读取。我看到有必要通过playsinline,但它不起作用。感谢的帮助

<script>
jQuery(document).ready(function($) {
var Video_back = new video_background($("#home"), { 
"position": "absolute", //Follow page scroll
"z-index": "-1",        //Behind everything
"loop": true,           //Loop when it reaches the end
"autoplay": true,       //Autoplay at start
"muted": true,          //Muted at start
"mp4":"ionos/videos/logo.mp4" ,     //Path to video mp4 format
"video_ratio": 1.7778,              // width/height -> If none provided sizing of the video is set to adjust
"fallback_image": "ionos/images/dummy.png",   //Fallback image path
"priority": "html5"             //Priority for html5 (if set to flash and tested locally will give a flash security error)
});
});
</script>

您需要playsinline属性,否则您无法在移动设备上使用它。不过,我不确定是否有一种方法可以让你使用标签。

示例:

<video width="100%" height="auto" autoplay muted loop playsinline id="my_video">
<source data-src="/video.mp4" type="video/mp4">
</video>

相关内容

  • 没有找到相关文章