html5视频预加载 [英] html5 video preload

查看:754
本文介绍了html5视频预加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以预加载html视频?注意:标记是在以后动态创建的.

Is it possible to preload an html video? Note: the tag is created dynamicly later.

当前,我可以通过创建一个隐藏的div并将所有图像放在其中来处理图像.然后,当我稍后创建需求时,不需要重新加载图像.

Currently I can do this with images by creating a hidden div and putting all the images in there. Then when I create the need later the image does not need to be reloaded.

使用video标签完成此操作后,浏览器仍然会在创建元素时从头开始加载视频.

When this is done with a video tag, the browser still loads the video from the beginning when the element is created.

我看到了以下内容: https://github.com/jussi-kalliokoski/html5Preloader.js ,但似乎不适用于视频.任何想法将不胜感激!

I saw this: https://github.com/jussi-kalliokoski/html5Preloader.js, but it does not seem to work with videos. Any ideas would be appreciated!

推荐答案

尝试一下:

<!DOCTYPE html>
<html>
<body>

<video width="320" height="240" controls="controls" **preload="auto"**>
  <source src="movie.mp4" type="video/mp4" />
  <source src="movie.ogg" type="video/ogg" />
  <source src="movie.webM" type="video/webM" />
  Your browser does not support the video tag.
</video>

</body>
</html>

注意:这不适用于IE;),为此,您可以使用某些播放器(只需包含.js).他们对IE使用 JW Player & JW Player预加载

Note: This doesnt work on IE ;), for this you can use some player(simply inclusion of a .js). They have a fallbak of flash for IE use JW Player & JW Player Preload

Njoy !!!

这篇关于html5视频预加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆