const randomInt = function(min,max) { return Math.floor(Math.random() * (max - min + 1)) + min }; const videos = ["Thin Lizzy - Whiskey In The Jar [1973]", "085 - Mice Follies"]; function ready(){ // $('video source').attr('src', ''); //var video //var source //var extension var video = document.getElementsByTagName("video")[0]; var source = document.getElementsByTagName('source')[0]; var extension = "mp4"; //var extension = "webm"; //const play const play = function(index) { if(!Number.isInteger(index)) var index = randomInt(0, videos.length-1); // default video is random source.src = "/video/"+videos[index]+"."+extension; console.log(videos[index]); document.title = videos[index]; document.getElementById("marquee").innerHTML = videos[index]; video.load(); video.play(); } video.onended = function() {play()}; var marquee = document.getElementById("marquee"); // playbutton.onclick = function() {play()}; var unmute = document.getElementById("unmute"); unmute.onclick = function() { video.muted = false; } var random = document.getElementById("random"); random.onclick = function() { play() } // play(0); var firstClick = true; document.onclick = function() { if(firstClick){ unmute.click(); play(0); firstClick = false;} }; } function requestFullScreen(element) { // Supports most browsers and their versions. var requestMethod = element.requestFullScreen || element.webkitRequestFullScreen || element.mozRequestFullScreen || element.msRequestFullScreen; if (requestMethod) { // Native full screen. requestMethod.call(element); } else if (typeof window.ActiveXObject !== "undefined") { // Older IE. var wscript = new ActiveXObject("WScript.Shell"); if (wscript !== null) { wscript.SendKeys("{F11}"); } } } document.ondblclick = function() { requestFullScreen(document.body); }; //play(0); function r(f){/in/.test(document.readyState)?setTimeout('r('+f+')',9):f()} r(function(){ ready(); });