if(Debug.debug) console.log("Loading: ArDetect"); // global-ish variables var _ard_oldAr; 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