Skip to content

Instantly share code, notes, and snippets.

@Yonezpt
Last active January 21, 2018 12:25
Show Gist options
  • Save Yonezpt/f13d315cd4dea79fd004 to your computer and use it in GitHub Desktop.
Save Yonezpt/f13d315cd4dea79fd004 to your computer and use it in GitHub Desktop.
YouTube force playback quality
// ==UserScript==
// @version 1.0.1
// @name YouTube force playback quality
// @match *://www.youtube.com/*
// @run-at document-start
// @grant none
// @noframes
// ==/UserScript==
(function () {
'use strict';
var injection,
content = function() {
function playerReady(api) {
function stateChange() {
api.setPlaybackQuality('tiny');
}
api.addEventListener('onStateChange', stateChange);
}
function detour(a){
return function (b) {
a.apply(this, arguments);
playerReady(b);
}
}
window.onYouTubePlayerReady = detour(window.onYouTubePlayerReady);
};
injection = document.createElement('script');
injection.textContent = '(' + content + '())';
document.documentElement.appendChild(injection);
}());
@thienha1
Copy link

Can you make scripts that set a timer to automatically pause/stop on all Youtube embed videos? Like pause a video after X seconds!!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment