Skip to content

Commit

Permalink
MDL-49059 medialib: Support links to Youtube videos within playlists
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pauln committed Feb 12, 2015
1 parent d518ff1 commit 8fcb99b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/medialib.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,13 @@ protected function embed_external(moodle_url $url, $name, $width, $height, $opti
$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"
Expand Down

0 comments on commit 8fcb99b

Please sign in to comment.