我一直在尝试找到一种同时显示 gif
的方法s 和 video
s ( .mp4
, .ogg
, .webm
) 在同一标签内。
所以,如果它在 <video>
内标签我只会更改来源或 <source>
到 gif
或 video
并相应地显示它。
不幸的是,我没有找到任何允许这样做的共识。
在我继续解决最困难的问题之前,有人能找到简单的解决方案吗?
最佳答案
根据 MDN
The HTML
<video>
element is used to embed video content. It may contain several video sources, represented using thesrc
attribute or the element; the browser will choose the most suitable one.
因此gif
- 不是视频内容 - 不是 <video>
中使用的选项标签
这是 supported formats 的列表对于 <video>
和 <audio>
关于javascript - 在 <video> 标签中使用 GIF,或在 <img> 标签中使用视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31330780/