Skip to content

Instantly share code, notes, and snippets.

@alexkirsz
Last active August 9, 2020 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save alexkirsz/822be594a4dc01742493 to your computer and use it in GitHub Desktop.
Save alexkirsz/822be594a4dc01742493 to your computer and use it in GitHub Desktop.
YouTube Player for edX
// ==UserScript==
// @name YouTube Player for edX
// @namespace morhaus
// @version 1.1
// @description Replace the default edX video player with the YouTube player
// @author Alexandre Kirszenberg <alexandre.kirszenberg@gmailcomr>
// @match https://courses.edx.org/*
// @match https://courses.ionisx.com/*
// @grant none
// ==/UserScript==
var oldFn = window.onYouTubeIframeAPIReady || null;
window.onYouTubeIframeAPIReady = function() {
var Player = YT.Player;
YT.Player = function(el, opts) {
new Player(el, {
videoId: opts.videoId,
events: {
onReady: function(e) {
document.querySelector('.video').className += ' is-initialized';
e.target.setPlaybackQuality('highres');
},
},
});
};
window.onYouTubeIframeAPIReady = oldFn;
oldFn && oldFn();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment