html - html 5 上的元数据预加载属性是否加载整个视频?

标签 html performance video pageload

当使用 html 5 video 标签时,preload="metadata" 属性是否已经加载了视频?我有点担心页面加载的性能问题是视频大小是否大于 100MB。

我注意到,当具有此属性时,会加载视频第一秒的图像,但不会完全播放视频。

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

最佳答案

preload 属性向浏览器提示是否值得乐观地下载视频本身或其元数据。

元数据不会立即下载所有视频,只有元数据。 规范建议将其设置为元数据。

这里有一个包含所有可用选项的列表:

none - Hints to the browser that the user likely will not watch the video, or that minimizing unnecessary traffic is desirable.

metadata - Hints to the browser 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.

auto - Hints to the browser that optimistically downloading the entire video is considered desirable.

更多信息:https://developer.mozilla.org/en/docs/Web/HTML/Element/video

关于html - html 5 上的元数据预加载属性是否加载整个视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39360088/

相关文章:

html - 激活 SPAN 上的溢出省略号,如果可能的话还可以环绕/使用高度

javascript - 当我们单击 ul 中的列表项时,如何将 fa-angle-left 更改为 fa-angle-down

php - 将两个字符串加在一起的最佳方法是什么?

Android Twilio Video - 获取相机流

node.js - 将 h.264 流包装在 mp.4 容器中并使用 nodejs 流式传输

html - 修复 mozilla firefox 中的文本区域问题

javascript - HTML如何编辑视频的布局

C# 屏幕流程序

html - 交换字体时的字体过渡

video - 以编程方式在视频剪辑上添加数百个图像叠加层