Let’s say I have a 4 minute video and I want it to start playing from the 25th second and not from the beginning.
<video autoplay loop id="bgvid">
<source src="back.mp4" type="video/mp4">
</video>
Let’s say I have a 4 minute video and I want it to start playing from the 25th second and not from the beginning.
<video autoplay loop id="bgvid">
<source src="back.mp4" type="video/mp4">
</video>
Try appending #t=TIME
<video autoplay loop id="bgvid">
<source src="back.mp4#t=25" type="video/mp4">
</video>
W3.org: Media Fragments URI - http://www.w3.org/TR/media-frags/
document.getElementById('bgvid').addEventListener('loadedmetadata', function() {
this.currentTime = 25;
}, false);
Yes Mohit, I've been looking for a very same functionality earlier on, according to this question, you can try this snippet of javascript code, it worked for me; [it is also a method to stop the video at a certain time]
function playVideo() {
var starttime = 2; // start at 2 seconds
var endtime = 4; // stop at 4 seconds
var video = document.getElementById('player1');
//handler should be bound first
video.addEventListener("timeupdate", function() {
if (this.currentTime >= endtime) {
this.pause();
}
}, false);
//suppose that video src has been already set properly
video.load();
video.play(); //must call this otherwise can't seek on some browsers, e.g. Firefox 4
try {
video.currentTime = starttime;
} catch (ex) {
//handle exceptions here
}
}