Last active
August 9, 2020 10:31
-
-
Save alexkirsz/822be594a4dc01742493 to your computer and use it in GitHub Desktop.
YouTube Player for edX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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