I\'m trying to place a video that autoplays without controls but I want to add three custom buttons below the video, each button jumps the video to a specific time. Not usin
You can set the currentTime
attribute of a video. Using your example:
var vidLinks = document.querySelectorAll('.navBtns a');
for(var i = 0, l = vidLinks.length; ++i){
makeVideoLink(vidLinks[i]);
}
function jumpToTime(time){
v.currentTime = time;
}
function makeVideoLink(element){
// Extract the `t=` hash from the link
var timestamp = element.hash.match(/\d+$/,'')[0] * 1000;
element.addEventListener('click', function videoLinkClick(e){
jumpToTime(timestamp);
return false;
},false)
}
Mozilla's Developer Network site has a great list of HTML5 media element properties.