From a16e03df3f2d5cd982bee76b1f14101464aa196a Mon Sep 17 00:00:00 2001 From: Paul Nicholls Date: Thu, 12 Feb 2015 09:34:33 +1300 Subject: [PATCH] MDL-49059 medialib: Support links to Youtube videos within playlists As well as embedding playlists, you can embed specific videos from them - resulting in the playlist UI displaying, but starting with the specified video rather than the first in the playlist. Previously, just the specified video would embed - without the playlist UI. --- lib/medialib.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/medialib.php b/lib/medialib.php index f4583c4eb95..9725e3550d7 100644 --- a/lib/medialib.php +++ b/lib/medialib.php @@ -542,6 +542,13 @@ class core_media_player_youtube extends core_media_player_external { $params .= "start=$start&"; } + $listid = $url->param('list'); + // Check for non-empty but valid playlist ID. + if (!empty($listid) && !preg_match('/[^a-zA-Z0-9\-_]/', $listid)) { + // This video is part of a playlist, and we want to embed it as such. + $params .= "list=$listid&"; + } + return <<