简体   繁体   English

如何使HTML5视频完全预加载

[英]How to make HTML5 video fully preloaded

I'm trying to make cross-browser, simple background video that start playing when it's fully loaded, but can't find a solution to this. 我正在尝试制作跨浏览器的简单背景视频,使其在满载时开始播放,但找不到解决方案。 I know about readyState === 4 , but it doesn't wait until the video is fully loaded. 我知道readyState === 4 ,但它不会等到视频完全加载后再显示。 Is there any way of doing this with classic JS(no jquery!)? 有没有办法用经典的JS(没有jquery!)做到这一点? Thanks! 谢谢!

There is attribute called preload. 有一个叫做preload的属性。 You can use it. 您可以使用它。

<video src="video.mp4" preload></video>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM