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.
This commit is contained in:
Paul Nicholls
2015-02-13 09:49:16 +13:00
parent b516be1d7e
commit a16e03df3f
+7
View File
@@ -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 <<<OET
<span class="mediaplugin mediaplugin_youtube">
<iframe title="$info" width="$width" height="$height"