You will need to install a user script manager extension to install this script.
Automatically play YouTube videos in high resolution. The video player on the page can be automatically resized to take advantage of the higher resolution.
YouTube quality can be set to any YouTube supported resolution from 144p to 8k+ (but is 1080p for auto HD setting of full HD by default). If the selected resolution is not available for a given video, the next best quality will be used.
If the option is enabled and YouTube is theater mode (and you are on the main YouTube website), the video box on screen will be resized to the size of the chosen resolution. A custom video player size can also be set to whatever you like, so you can maximize video space for your specific screen. A high resolution video will look better even in a small player due to YouTube being extremely stingy with bit-rates, so a high resolution with a custom size is recommended. There is an auto theater mode option so you don't have to click anything to enable resizing if desired.
This script is intended only for the YouTube website, and not videos embedded on other websites. However, there is experimental and unofficial support for embeds if enabled by changing the metadata to run on all websites and frames. This currently is known to correctly set the resolution but incorrectly label it as auto.
This script tries to be compatible with many browsers and many user script managers including Greasemonkey 4.