gpt4 book ai didi

html - 使用 HTML 5

转载 作者:行者123 更新时间:2023-12-04 12:52:37 26 4
gpt4 key购买 nike

W3Schools 页面显示了有关如何使用视频标签的示例。

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

我的问题是:

  1. 视频何时下载到用户浏览器?在页面加载时,或者当他按下播放键时?
  2. 是否依赖于浏览器?是否可能每个浏览器在不同时间下载视频?

我问的原因是因为我们正在探索使用付费服务来托管我们的视频文件,而不是谷歌,所以我们的视频没有广告或其他东西,并且正在尝试计算多少带宽我们可能会使用(不是每个访问我们页面的人都可以选择点击视频上的“播放”)。

编辑 - 如果我们指定多种类型,如 mp4、ogg 等,是否会下载所有兼容的支持类型?或者只是第一个支持的类型?

最佳答案

您可以为 <video> 指定属性将向浏览器“建议”您希望视频如何表现的标签:

preload

This enumerated attribute is intended to provide a hint to the browserabout what the author thinks will lead to the best user experience. Itmay have one of the following values:

  • none: hints that either the author thinks that the user won't need to consult that video or that the server wants to minimize itstraffic; in others terms this hint indicates that the video should notbe cached.

  • metadata: hints that though the author thinks that the user won't need to consult that video, fetching the metadata (e.g. length) isreasonable.

  • auto: hints that the user needs have priority; in others terms this hint indicated that, if needed, the whole video could be downloaded,even if the user is not expected to use it.

  • the empty string: which is a synonym of the auto value.

更多信息 here .

一般来说,与 W3SCHOOLS 相比,MDN 将成为获取此类详细信息的更好资源。

关于html - 使用 HTML 5 <video> 标签时,何时从源下载视频?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21507811/

26 4 0