Html 在 HTML4 和 HTML5 中嵌入视频

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5800822/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 08:15:08  来源:igfitidea点击:

Embeding a Video in HTML4 vs HTML5

htmlhtml5-videohtml4

提问by Simsons

While searching for difference between HTML4 and HTML5 I came across the point that :

在寻找 HTML4 和 HTML5 之间的差异时,我发现了一点:

HTML5 brings a whole new dimension to web world. It can embed video on web-pages without using any special software like Flash

HTML5 为网络世界带来了全新的维度。它可以在网页上嵌入视频,而无需使用任何特殊软件,如 Flash

So if we will consider a sample code in HTML4 then for embeding video then that will be:

因此,如果我们考虑使用 HTML4 中的示例代码,那么对于嵌入视频,它将是:

<embed src="MyVideo.mp4"/>

While the above code can be written in HTML5 will be:

虽然上面的代码可以用 HTML5 写成:

<video src="MyVideo.mp4"></video>

So what can I see is just the syntax difference. Apart from that what else is the difference.

所以我能看到的只是语法差异。除此之外还有什么区别。

Does this mean if we will use HTML5 to embed a video then the browser is not going to use any third parties software to play the video?

这是否意味着如果我们将使用 HTML5 嵌入视频,那么浏览器将不会使用任何第三方软件来播放视频?

采纳答案by Jon Skarpeteig

The idea regarding the tag is that the browsers should have native support for it, without the use of any additional software. The standard is not yet ready, and one of the points not agreed upon is regarding what codecs to support. For more information you could have a look at the html5 video wikipage which includes a list of which browsers support what formats.

关于标签的想法是浏览器应该对它有本机支持,而不需要使用任何额外的软件。该标准尚未准备就绪,未达成一致的观点之一是关于支持哪些编解码器。有关更多信息,您可以查看html5 视频 wiki页面,其中包含哪些浏览器支持哪些格式的列表。

If you are planning on implementing the html5 video tag, you should provide backwards compatibility. One way is to use the VideoJSlibrary, which will fall back to flash, if the browser doesn't support the video source.

如果您计划实施 html5 视频标签,您应该提供向后兼容性。一种方法是使用VideoJS库,如果浏览器不支持视频源,它将回退到 Flash。

回答by CloudyMarble

The current HTML5 draft specification does not specify which video formats browsers should support in the video tag. User agents are free to support any video formats they feel are appropriate. In cases where decoders are not built into the browser, the format support will be dictated by the multimedia framework of the operating system.

当前的 HTML5 草案规范没有在 video 标签中指定浏览器应该支持哪些视频格式。用户代理可以自由地支持他们认为合适的任何视频格式。如果浏览器未内置解码器,则格式支持将由操作系统的多媒体框架决定。

回答by OpenCode

Here is what you might want to see : 20 Examples of HTML5 Video Player with Source

以下是您可能希望看到的内容:20 个带有源代码的 HTML5 视频播放器示例

VideoJSis an HTML5 Video Player, built with Javascript and CSS, with a fallback to a Flash video player for when the browser doesn't support HTML5 video.

VideoJS是一个 HTML5 视频播放器,使用 Javascript 和 CSS 构建,当浏览器不支持 HTML5 视频时,它会回退到Flash 视频播放器。