gpt4 book ai didi

html - 在 html 页面中嵌入视频并使其播放本地驱动器中的任何视频文件

转载 作者:搜寻专家 更新时间:2023-10-31 08:20:54 25 4
gpt4 key购买 nike

我想在 html 页面中嵌入视频,以便我可以播放硬盘驱动器或 url 中的任何多媒体文件。我尝试使用

创建网页
<video src="test.mp4" controls width="320" height="240">

</video>

chrome ,视频播放没有任何问题。但是,在 firefox 中无法识别 mp4 文件.它显示错误消息- 'no video with supported format or mimetype found'.

碰巧我的大部分视频文件都是.mp4 or .flv文件。

如果我把 <source src="test.flv" />在视频元素中,然后 chrome 和 firefox 都无法显示它。

那么,我该怎么做才能玩at least mp4 and flv files in both browsers

非常感谢任何指点/建议。

最佳答案

来自 Mozilla 的页面 browser-supported audio/video formats :

The MPEG container format with the H.264 video codec and either the AAC audio codec or the MP3 audio codec is supported by Internet Explorer and Safari. Firefox and Opera do not support the format. Support for the format is deprecated in Chrome, and Chromium does not support it either.

The MPEG media formats are covered by patents, which are not freely licensed. All the necessary licenses can be bought from MPEG LA. Since H.264 is currently not a royalty free format, it is unfit for the open web platform, according to Mozilla [1, 2], Google [1, 2] and Opera.

简短的回答,Firefox 不支持 mp4,因为它不是开源的。但它确实支持多种来源,并且会播放它支持的第一个来源。

此外,似乎没有任何浏览器支持 swf 或 flv,因为它们完全是 Adob​​e 并且需要 Flash Player,但以下应该解决这个问题:

<video src="test.mp4" controls>
<object data="test.flv" type="application/x-shockwave-flash">
<param value="test.flv" name="movie"/>
</object>
</video>

请注意,上面的数据和值最初是 .swf 文件;我还没有测试 .flv 是否可以独立运行。

关于html - 在 html 页面中嵌入视频并使其播放本地驱动器中的任何视频文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10429629/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com