本文介绍了在页面加载时或仅在播放视频时做HTML 5视频缓冲?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我想在页面中嵌入20个视频,它们是否都会在页面加载时开始缓冲,或者是否会等到它们第一次播放/交互?如果他们在负载上缓冲,我怎么能绕过这个,直到我想显示视频?我不希望用户缓存20个视频,因为他们可能只会看一个,甚至根本看不到。

解决方案

您正在查看HTML5 视频标签的预加载属性。以下是。基本上有三种选择:

  auto  - 浏览器在页面加载时加载整个视频
metadata - when浏览器只能在页面加载时加载元数据
none - 当页面加载时浏览器不应加载视频


If I wanted to embed 20 videos on a page will they all start buffering on page load or will they wait until they are played/interacted with for the first time? If they buffer on load how could I circumvent this until I want to display the video? I don't want a user to be buffering 20 videos when they may only be watching one or even none at all.

解决方案

You are looking at the preload attribute of HTML5 video tag. Here is the doc. Basically there are three options :

 auto - when browser should load the entire video when the page loads
 metadata - when browser should load only metadata when the page loads
 none - when browser should NOT load the video when the page loads

这篇关于在页面加载时或仅在播放视频时做HTML 5视频缓冲?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 06:31