📅  最后修改于: 2020-11-04 00:54:51             🧑  作者: Mango
HTML 5支持
当前,HTML视频标签支持三种视频格式:
让我们看一下定义了哪个Web浏览器支持视频文件格式的表。
Browser | mp4 | webM | ogg |
---|---|---|---|
Internet Explorer | yes | no | no |
Google Chrome | yes | yes | yes |
Mozilla Firefox | yes | yes | yes |
Opera | no | yes | yes |
Apple Safari | yes | no | no |
Android还支持mp4格式。
让我们看看使用HTML video标签播放mp4文件的代码。
让我们看一下使用HTML视频标签播放ogg文件的示例。
Element | Chrome | IE | Firefox | Opera | Safari |
Yes | Yes | Yes | Yes | Yes |
让我们看一下HTML 5视频标记属性的列表。
Attribute | Description |
---|---|
controls | It defines the video controls which is displayed with play/pause buttons. |
height | It is used to set the height of the video player. |
width | It is used to set the width of the video player. |
poster | It specifies the image which is displayed on the screen when the video is not played. |
autoplay | It specifies that the video will start playing as soon as it is ready. |
loop | It specifies that the video file will start over again, every time when it is completed. |
muted | It is used to mute the video output. |
preload | It specifies the author view to upload video file when the page loads. |
src | It specifies the source URL of the video file. |
让我们看一下使用高度,宽度,自动播放,控件和循环属性的HTML视频标记示例。
可用的MIME类型HTML视频标签如下所示。
Video Format | MIME Type |
---|---|
mp4 | video/mp4 |
ogg | video/ogg |
webM | video/webM |