Yet Another Youtube Script

A lightweight and non-intrusive userscript that control video playback and set the preferred player size and playback quality on YouTube.

The script uses the official YouTube Player API, which means it works seamlessly and is probably more stable than other solutions.

Tested in Firefox 39.0, Chrome 39.0 and Opera 19.0.

There is a Safari Extension build of this script maintained by Dachaz. The package is available on his site.

FirefoxChromeOperaSafari

Manual

A new button with a "cogwheel" icon will appear below the video player. When you click the button, a panel will show up with three options:

Quality

You can choose your preferred playback quality which is set automatically when the video loaded. Beside the standard resolutions (144p, 240p, 360p, 480p, 720p, 1080p, 1440p) there are two special options:

AUTOLet the player choose the proper quality. (default)
ORIGINALSet the highest available quality.

Please keep in mind that YouTube tends to override your preference when you switch to fullscreen and you have chosen a quality below 720p.

Size

You can set the default player size to one of the standard resolutions or one of these:

AUTOLet YouTube handle the player size. (default)
WIDESet the wide size as the default.

Playback

You can set the default playback state:

STARTThe video starts as soon as possible. (default)
PAUSEThe playback is paused but the player keep buffering.
STOPThe playback is stopped and the player doesn't buffer either.
AUTO PAUSELike PAUSE but only for videos opened in a background tab, and also the playback will automatically be started when the tab gets focus.
AUTO STOPLike AUTO PAUSE but the playback will be stopped instead of paused.

Translations

English, Hungarian, Dutch (by Mike-RaWare), Spanish (by yonane, Dinepada and jdarlan), German (by xemino and ich01), Portuguese (by Pitukinha), Greek (by TastyTeo), French (by eXa), Slovenian (by Paranoia.Com), Russian (by an1k3y), Hebrew (by baryoni), Chinese (by blankhang), Polish (by mkvs), Swedish (by eson), Ukrainian (by mukolah)

FAQ

It would be great if I could disable annotations permanently.

Currently this can not be done with the Player API, so there isn't any safe way to do that. But you can disable the annotations in your account settings.

Why the script doesn't work for embedded videos?

This script was designed to not run in iframes or to work with any form of video embedding outside of YouTube. Embedded players can be customized by the embedding site so they are even less predictable than the standard player on YouTube. It is not even guaranteed that they are configured in a way they can be controlled by JavaScript.

Why the player stops buffering after a couple of seconds?

YouTube is using a streaming method called DASH, which dynamically change the video quality based on the streaming conditions (player size, network throughput). This method buffers only a couple of seconds ahead of the current playback position.

Any chance getting an option to disable DASH?

This can be implemented as soon as YouTube expose an API to do that.

I have a problem with the HTML5 player...

There are a couple of known issues with the HTML5 player, which I can not or do not want to solve. These issues have minor influence on the user experience in my opinion. Sure, they can be annoying, but having to maintain a script with tricks and hacks to workaround all these issues would be a nightmare due to the frequent changes of YouTube.

Related

GitHub repository
Greasy Fork page
OpenUserJS page
Gresemonkey or Scriptish for Firefox
Tampermonkey for Google Chrome, Opera Next and Safari

Source

Changelog

1.15.1aug 16, 2015Fix quality not set properly in the new HTML5 player.
1.15may 23, 2015Reworked player sizing.
1.14jan 11, 2015Handle multiple player instances or in other words, better handling of SPF.
Detect if the player was muted by the script, and unmute properly.
Some UI fixes and removal of obsolete codes.
1.13aug 23, 2014Fixes for Firefox and it's older derivatives.
Reintroduce the CSS transformation trick for the HTML5 player.
1.12jul 20, 2014Migration to the new Add-on API for content scripts in Firefox 30/Greasemonkey 2.0.
Handle some changes in the YouTube layout and the HTML5 player.
Prevent breaking the playback resume feature of YouTube.
1.11feb 16, 2014Refactoring to workaround an issue with Scriptish.
CSS fix for the new centered layout.
Spanish translation updated.
1.10.1dec 31, 2013Quick fix for WebKit based browsers.
1.10dec 28, 2013Inject the script before the document is loaded to intercept the player as soon as possible.
Properly position and scale the annotations when using a non-standard player size.
Fix some issues with Chrome.
Added the 1440p quality level.
Swedish translation updated.
1.9nov 23, 2013Fix for videos with time-specific URLs.
No more muted playback.
Fewer changing of video quality in the middle of the playback.
Refactoring and minor improvements.
Ukrainian translation added. German, Polish and Chinese translations updated.
1.8.2aug 23, 2013Hotfix for Firefox 22- including Pale Moon.
1.8aug 22, 2013The prevent auto play feature is reworked to also handle auto buffering.
Added support for the experimental Feather UI of YouTube.
Minor fixes and improvements.
1.7jul 20, 2013Made compatible with YouTube's new AJAX based navigation.
Added the 144p quality (also introduce migrations).
Minor improvements and major code refactoring.
Improved update notification.
German translation updated.
1.6.3may 24, 2013Added settings panel for the new channel UI.
Playlist CSS issues fixed.
Autoplay on page focus refactored.
Spanish and Polish translations updated.
1.6.2mar 29, 2013Polish and Swedish translations added, French and Chinese translations updated.
Layout and compatibility fixes.
1.6.1mar 09, 2013Layout fixes.
Fix an issue of the auto pause feature with the HTML5 player.
Chinese translation added.
1.6dec 09, 2012Update the interface to the new YouTube layout.
Fix the rebuffering issue.
Code cleanup.
1.5.8sep 02, 2012Handle videos with start-at URLs, also known as deep-linking.
The quality selector now covers all available playback qualities.
Define some additional metadatas for Greasemonkey and Scriptish.
Fix Firefox 15 compatibility issues.
Some code cleanup and improvements.
1.5.7jun 22, 2012Experimenting with the Visibility API.
Fix script not loading in Chrome/Tampermonkey.
Quality selector improvements.
1.5.6.1may 21, 2012Quick fix: Don't mute when quality changed.
1.5.6may 20, 2012Some optimization to improve stability.
Prevent the script to run inside a frame.
Hebrew translation added.
1.5.5apr 14, 2012Fix a bug which broke some default player functionality.
Experimenting with auto mute until auto pause take effect.
Russian translation added.
1.5.4feb 12, 2012Compatibility update.
Player size selector added.
Slovenian translation added.
1.5.3dec 17, 2011Support for the HTML5 video player.
Follow the new interface design.
Minor fixes.
1.5.2sep 22, 2011Compatibility update.
French translation added.
1.5.1feb 05, 2011Quality selector fixes.
Greek translation added.
1.5dec 24, 2010Compatibility and layout update.
New Autoplay option: AUTO (beta)
1.4.3jul 24, 2010Improved compatibility.
Portuguese translation added.
1.4.2jun 23, 2010Another quick fix for Safari.
Bugfix for Chrome.
1.4.1jun 22, 2010Quick fix for Safari.
German translation added.
1.4jun 21, 2010Interface update.
Code refactoring.
1.3.1apr 15, 2010Compatibility update.
Added "very high" option to the quality selector.
Bugfix for Opera.
Drop IE support.
1.3apr 09, 2010Update for the new YouTube interface.
Improved update functionality with YQL.
1.2feb 26, 2010Trying to solve interference with other YouTube scripts.
Update checker functionality added.
General improvements and bugfixes.
1.1.3jan 17, 2010Spanish translation added.
Bugfix for Chrome.
1.1.2jan 17, 2010Dutch translation added.
1.1.1jan 16, 2010Internet Explorer support.
1.1jan 15, 2010Opera and Chrome support.
Store the configuration persistently with Greasemonkey.
1.0.1jan 01, 2010Minor optimization.
1.0jan 01, 2010Initial release.