diff --git a/README.md b/README.md index 35e0303..019bb9d 100644 --- a/README.md +++ b/README.md @@ -12,8 +12,8 @@ Better YouTube + works to improve the YouTube experience by providing quick acce * It shows volume level as you scroll. * It lets Unix, Linux, and MacOS systems have the ability to download the video using native app calls. -# Version: 1.5.5 -* Added 1080p playback defaulting. +# Version: 1.5.6 +* 1080p playback defaulting... fix ...? # Download https://addons.mozilla.org/en-US/firefox/addon/better-youtube-plus/ diff --git a/src/manifest.json b/src/manifest.json index 5fcdd8a..2f71fb4 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Better Youtube +", - "version": "1.5.5", + "version": "1.5.6", "description": "Enhancements for Youtube to have a better experience.", "applications": { diff --git a/src/scripts/betterYoutube.js b/src/scripts/betterYoutube.js index 5eb8a9a..cb581ef 100644 --- a/src/scripts/betterYoutube.js +++ b/src/scripts/betterYoutube.js @@ -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"); - // 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); + } } const setupObservers = () => {