更新时间:2023-09-21 23:27:46
而不是使用<来源>
代码,使用< src>
属性< video>
,如下所示你会看到这个动作。
Instead of using <source>
tag, use <src>
attribute of <video>
as below and you will see the action.
<video width="320" height="240" src="mov1.mov"></video>
或
您可以提供多个标签在标签内,每个都有不同的视频源。浏览器将自动浏览列表并选择能够播放的第一个列表。例如:
you can give multiple tags within the tag, each with a different video source. The browser will automatically go through the list and pick the first one it’s able to play. For example:
<video id="sampleMovie" width="640" height="360" preload controls>
<source src="HTML5Sample_H264.mov" />
<source src="HTML5Sample_Ogg.ogv" />
<source src="HTML5Sample_WebM.webm" />
</video>
如果您在Chrome中测试该代码,您将获得H.264视频。不过在Firefox中运行它,你会在同一个地方看到Ogg视频。
If you test that code in Chrome, you’ll get the H.264 video. Run it in Firefox, though, and you’ll see the Ogg video in the same place.