在.mov和.webm视频格式之间切换,而无需检查浏览器

发布于 2025-02-11 20:59:56 字数 424 浏览 1 评论 0原文

是否可以向HTML5视频标签提供两个源,然后让浏览器(Chrome and Safari)决定自动选择哪个,如果有问题的来源是:

  • safari可以透明的.MOV文件,而不是Chrome a Chrome
  • A .webm文件具有透明度(Safari不应用) ?

目前,如果我将.mov文件放在第一个Chrome试图播放它,而忽略第二个.webm源。如果.webm文件是第一个文件,则Safari在没有透明度的情况下播放它。

我不知道要指定哪种类型属性以使后备工作。例如:type =“ VIDEO/MOV”不被Web标准接受,type =“ Video/Mp4” for .mov让Chrome认为它可以播放它。

如果可能的话,我想避免使用JavaScript检查浏览器。

Is it possible to provide to an HTML5 video tag two sources and let the browser (Chrome and Safari) decide which one to pick automatically, if the sources in question are:

  • a .MOV file with transparency readable by Safari, but not by Chrome
  • a .WEBM file with transparency (that is not applied by Safari)
    ?

At the moment if I put the .MOV file first Chrome tries to play it, ignoring the second .WEBM source. And if the .WEBM file is the first one, Safari plays it without transparency.

I don't know what type attribute to specify to make the fallback work. For example: type="video/mov" is not accepted by web standards and type="video/mp4" for the .MOV makes Chrome think it can play it.

I would like to avoid checking for the browser with javascript if possible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文