if(Debug.debug) console.log("Loading: ArDetect"); // global-ish variables var _ard_oldAr; var _ard_currentAr; // kjer vzemamo vzorce za blackbox/stuff. 9 vzorcev. Če spremenimo velikost vzorca, moramo spremeniti tudi vrednosti v tej tabeli // vrednosti v tabeli so na osminskih intervalih od [0, - 4]. // we sample these lines in blackbox/stuff. 9 samples. If we change the canvas sample size, we have to correct these values as well // samples are every eighth between [0, - 4]. var _ard_sampleLines = [ 0, 360, 720, 1080, 1440, 1800, 2160, 2520, 2876] // **** FUNCTIONS **** // var _arSetup = function(){ var vid = document.getElementsByTagName("video")[0]; if(vid === undefined){ setTimeout(_arSetup, 1000); return; } var canvas = document.createElement("canvas"); canvas.style.position = "absolute"; //todo: change those values to push canvas off-screen canvas.style.top = "1080px"; canvas.style.zIndex = 10000; // var test = document.getElementsByClassName("content style-scope ytd-video-secondary-info-renderer")[0] var test = document.getElementsByTagName("body")[0]; test.appendChild(canvas); console.log("test: ", test, "vid: ", vid, "canvas: ", canvas); // vid.append(canvas); var context = canvas.getContext("2d"); // do setup once // tho we could do it for every frame var canvasScaleFactor = 1280 / vid.videoWidth; var canvasWidth = vid.videoWidth * canvasScaleFactor; var canvasHeight = vid.videoHeight * canvasScaleFactor; canvas.width = canvasWidth; canvas.height = canvasHeight; // init oldAr to physical