From dcd9ca3a93a669b69f0e4fc7831bd645ce0ec3ee Mon Sep 17 00:00:00 2001 From: Sam Potts Date: Sun, 12 Jul 2015 23:57:36 +1000 Subject: Started on source swap --- src/js/plyr.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/js/plyr.js b/src/js/plyr.js index 665a8782..41abe085 100644 --- a/src/js/plyr.js +++ b/src/js/plyr.js @@ -1584,6 +1584,17 @@ // Update source // Sources are not checked for support so be careful function _parseSource(sources) { + // YouTube + if(player.type === "youtube" && typeof sources === "string") { + if(sources.indexOf("http") === 0) { + player.embed.loadVideoByUrl(sources); + } + else { + player.embed.loadVideoById(sources); + } + return; + } + // Pause playback (webkit freaks out) _pause(); -- cgit v1.2.3