Is it possible to seek to a particular point in html5 video
displayed in a web page? I mean ,can I input a particular time value (say 01:20:30:045
) and have the player control (slider) move to that point and play from that point onwards?
In older version of mozilla vlcplugin
I think this is possible by seek(seconds,is_relative)
method..but I would like to know if this is possible in html video.
Edit:
I created the page with video and added javascript as below.When I click on the link ,it displays the time of click..but it doesn't increment the play location..but continues to play normally.
Shouldn't the video play location get changed?
html
<video id="vid" width="640" height="360" controls> <source src="/myvid/test.mp4" type="video/mp4" /> </video> <a id="gettime" href="#">time</a> <p> you clicked at:<span id="showtime"> </span> </p>
javascript
$(document).ready(function(){ var player = $('#vid').get(0); $('#gettime').click(function(){ if(player){ current_time=player.currentTime; $('#showtime').html(current_time+" seconds"); player.currentTime=current_time+10; } }); } );
The <video> tag is used to embed video content in a document, such as a movie clip or other video streams. The <video> tag contains one or more <source> tags with different video sources. The browser will choose the first source it supports.
The HTML5 video format capabilities include three options to play: MP4, WebM, and Ogg. You should note that the Safari browser does not support Ogg, WebM is supported by only 58% of browsers, and MP4 is disabled by default in Firefox 24.
". wmv" video files are not supported by any browser.
You can use v.currentTime = seconds;
to seek to a given position.
Reference: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/currentTime
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With