YouTube Auto HD + FPS

A script that automatically sets YouTube videos to 1080p with 30 fps.

  1. // ==UserScript==
  2. // @name YouTube Auto HD + FPS
  3. // @description A script that automatically sets YouTube videos to 1080p with 30 fps.
  4. // @version 1.0
  5. // @author Midnight
  6. // @namespace https://google.com
  7. // @match *://*/*
  8. // @run-at document-start
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. "use strict";
  15.  
  16. const log = console.log;
  17.  
  18. // Get the YouTube player
  19. const player = document.querySelector("ytd-player");
  20.  
  21. // Set the video quality to 1080p
  22. player.playbackQuality = "hd1080";
  23.  
  24. // Set the highest frame rate to 30 fps
  25. player.maxFps = 30;
  26.  
  27. // If the user changes the video quality, reset it to 1080p
  28. player.onPlaybackQualityChange = function(quality) {
  29. if (quality !== "hd1080") {
  30. player.playbackQuality = "hd1080";
  31. }
  32. };
  33.  
  34. })();