Last active
August 7, 2022 01:37
-
-
Save katopz/06a2958ad7591de0ed3044038009a32c to your computer and use it in GitHub Desktop.
keep youtube at hi resolution
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://gist.github.com/adisib/1e6b429b9bb630fceb170f3fa77c57a3 | |
let ytPlayer = document.getElementById("movie_player") || document.getElementsByClassName("html5-video-player")[0]; | |
let quality = ytPlayer.getAvailableQualityLevels()[0]; | |
ytPlayer.stopVideo(); | |
ytPlayer.setPlaybackQualityRange && ytPlayer.setPlaybackQualityRange(quality) | |
ytPlayer.setPlaybackQuality(quality); | |
let storedQuality = localStorage.getItem('yt-player-quality') | |
if (!storedQuality || storedQuality.indexOf(quality) === -1) { | |
let tc = Date.now(), | |
te = tc + 2592000000 | |
localStorage.setItem('yt-player-quality', '{"data":"' + targetRes + '","expiration":' + te + ',"creation":' + tc + '}') | |
} | |
ytPlayer.playVideo(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment