snaphash/index.js
2015-09-25 19:03:45 +03:30

15 lines
360 B
JavaScript

var range = document.querySelector('input');
var video = document.querySelector('video');
var img = document.querySelector('img');
video.addEventListener('canplay', function() {
range.max = parseInt(video.duration, 10);
})
range.addEventListener('input', function() {
img.dataset.snap = '#myvideo@' + range.value;
Snaphash('img');
})
Snaphash('img');