当使用 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/