Implement video view page

This commit is contained in:
2020-05-05 12:16:15 +02:00
parent f5be1b5156
commit 3a06e4ec9f
6 changed files with 132 additions and 1 deletions

24
static/js/video.js Normal file
View File

@@ -0,0 +1,24 @@
function init() {
var hash = document.location.hash;
var res = hash.match(/t=([0-9]+)/);
if (res) {
var vids = document.getElementsByTagName('video');
// only first video
var vid = vids[0];
vid.currentTime = res[1];
vid.autoplay = true;
}
}
init();
function vidTimeInUrl(el) {
var vids = document.getElementsByTagName('video');
// only first video
var vid = vids[0];
var currentTime = vid.currentTime;
var href = el.href + "#t=" + parseInt(currentTime);
el.href = href;
return true;
}