mirrored from git://git.moodle.org/moodle.git
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-62401 Media: Embed Youtube Videos with nocookie extension
Refactor YouTube media player to use templates. Use mustache templates for rendering YouTube embed iframe code.
- Loading branch information
Matt Porritt
committed
Jul 26, 2023
1 parent
b4cd637
commit 6d38972
Showing
2 changed files
with
81 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{{! | ||
This file is part of Moodle - http://moodle.org/ | ||
Moodle is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
Moodle is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with Moodle. If not, see <http://www.gnu.org/licenses/>. | ||
}} | ||
{{! | ||
@template media/embed | ||
This template will render the YouTube embeded player. | ||
Variables required for this template: | ||
* info: The title of the video. | ||
* width: The width of the video. | ||
* height: The height of the video. | ||
* embedurl: The URL to the video. | ||
Example context (json): | ||
{ | ||
"info": "YouTube video", | ||
"width": 640, | ||
"height": 360, | ||
"embedurl": "https://www.youtube.com/embed/9bZkp7q19f0?rel=0&wmode=transparent" | ||
} | ||
|
||
}} | ||
|
||
<span class="mediaplugin mediaplugin_youtube"> | ||
<iframe title="{{info}}" width="{{width}}" height="{{height}}" style="border:0;" | ||
src="{{{embedurl}}}" allow="fullscreen"></iframe> | ||
</span> |