防止HTML 5视频一次下载整个文件

时间:2013-07-29 11:15:37

标签: html5 video streaming

我想知道是否有可能只下载html5视频的前5个块(5MB),因此在显示视频> 100MB

时会阻止高流量账单

1 个答案:

答案 0 :(得分:0)

对此进行控制的唯一方法是使用视频标记上的preload属性。遗憾的是,这在不同的浏览器中实现的方式不同(例如,auto可能会下载2s,25s或整个视频,具体取决于连接。)

FMS或IIS SmoothStreaming等解决方案允许更多控制,但需要插件(Flash或Silverlight)来管理该体验

preload='none'
From the spec, “Hints to the UA that the user is not expected to need the video, or that     minimizing unnecessary traffic is desirable.”
preload='metadata'
“Hints to the UA that the user is not expected to need the video, but that fetching its  metadata (dimensions, first frame, track list, duration, and so on) is desirable.”
preload='auto'
“Hints to the UA that optimistically downloading the entire video is considered desirable.”
preload or preload=''
The preload attribute is specified but no value is given. Specifying the empty string is the same as specifying “auto”.