|
|
|
@ -143,22 +143,16 @@
|
|
|
|
|
|
|
|
|
|
// Video Controler
|
|
|
|
|
video = document.getElementsByTagName("video")[0]; // Actual video object (I think...)
|
|
|
|
|
player = document.getElementById("movie_player"); // ? Something like a meta information and signal object????
|
|
|
|
|
part = "https://img.youtube.com/vi/";
|
|
|
|
|
|
|
|
|
|
// Container of actual player (Used for floating window)
|
|
|
|
|
containerOfPlyrWndow = document.getElementById("player-container");
|
|
|
|
|
part = "https://img.youtube.com/vi/";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const fillUIAndSetupEvents = () => {
|
|
|
|
|
slugInputTag.value = video.baseURI.slice(32, 32+11);
|
|
|
|
|
ytRangeStart.value = "0:00";
|
|
|
|
|
|
|
|
|
|
// We need to wait for info to load before getting full duration
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
videoTimeLength = document.getElementsByClassName("ytp-time-duration")[0].innerText;
|
|
|
|
|
ytRangeEnd.value = videoTimeLength;
|
|
|
|
|
}, 2000);
|
|
|
|
|
|
|
|
|
|
// Only setting these up if we need to load controls' info
|
|
|
|
|
if (!controlsAreLoaded) {
|
|
|
|
@ -177,10 +171,20 @@
|
|
|
|
|
// Dragable window for floating video event setup
|
|
|
|
|
dragVideo(poppedContainer);
|
|
|
|
|
|
|
|
|
|
// I don't think this works... =[
|
|
|
|
|
let resolutionStateChange = setInterval(function () {
|
|
|
|
|
player = document.getElementById("movie_player");
|
|
|
|
|
if (video.readyState === 4 && player !== undefined) {
|
|
|
|
|
clearInterval(resolutionStateChange);
|
|
|
|
|
// ? Something like a meta information and signal object????
|
|
|
|
|
// If 1080p not present, api plays the next lowest available resolution.
|
|
|
|
|
player.setPlaybackQualityRange("hd1080","hd1080");
|
|
|
|
|
|
|
|
|
|
videoTimeLength = document.getElementsByClassName("ytp-time-duration")[0].innerText;
|
|
|
|
|
ytRangeEnd.value = videoTimeLength;
|
|
|
|
|
}
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if 1080p not present, api plays the next lowest available resolution.
|
|
|
|
|
player.setPlaybackQualityRange("hd1080","hd1080");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const setupObservers = () => {
|
|
|
|
|