-
-
Save mpontus/ff8f476caf1cffc7f9d8764170077ab9 to your computer and use it in GitHub Desktop.
YouTube Player for edX
This file contains hidden or 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