I want ...">

HTML5 video element, start and end time

I have an html5 video element.

<video id="video" loop="loop"> <source src="src.mov"> </video> 

I want it to start at a certain time in the video (say ... 10 seconds) and end at a certain time (27 seconds)

I know you can do it in JavaScript, but I want to do it in html. Is there a start / end time tag for a video element?

+6
source share
1 answer

You can specify the playback range by adding the source and ending time to the source URL.

The time should be in the format:

 #t=[starttime][,endtime] 

From MDN:

Part of the playback range of the media element URI specification was added in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6).

Here is an example of video playback, starting from the second and ending with the 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> 

Literature:

Temporary measurement of media URIs
Mozilla Integration Record (Error 648595)

Sample videos from techslides.com

+8
source

Source: https://habr.com/ru/post/977515/


All Articles