问题描述
我有一个html5视频元素.
I have an html5 video element.
<video id="video" loop="loop">
<source src="src.mov">
</video>
我希望它在视频中的某个时间(比如说... 10秒)开始并在某个时间(27秒)结束
I want it to start at a certain time in the video (lets say... 10 seconds) and end at a certain time (27 seconds)
我知道您可以使用JavaScript进行此操作,但是我想使用html进行此操作.视频元素是否有开始/结束时间标签?
I know that you can do this in JavaScript, however I want to do this in html. Is there a start / end time tag for the video element?
推荐答案
时间应采用以下格式:
#t=[starttime][,endtime]
来自MDN:
下面是一个播放视频的示例,该视频从第二秒开始,到第二秒3:结束.
Here's an example to play a video, starting from second 2 and ending at second 3:
<video controls autoplay>
<source src=http://techslides.com/demos/sample-videos/small.webm#t=2,3 type=video/webm>
<source src=http://techslides.com/demos/sample-videos/small.ogv#t=2,3 type=video/ogg>
<source src=http://techslides.com/demos/sample-videos/small.mp4#t=2,3 type=video/mp4>
<source src=http://techslides.com/demos/sample-videos/small.3gp#t=2,3 type=video/3gp>
</video>
参考:
媒体片段URI的时间维度
Mozilla集成记录(错误648595)
示例视频来自 techslides.com
Temporal Dimension of Media Fragments URI
Record of Mozilla integration (bug 648595)
Sample videos are from techslides.com
这篇关于html5视频元素,开始和结束时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!