diff --git a/filter.php b/filter.php index 9dd707a237821d69a37a8e2eae21b7cb8b99f762..bc2f70852383d9d3a580d969b0f90cef63ad0982 100644 --- a/filter.php +++ b/filter.php @@ -47,7 +47,7 @@ class filter_opencast extends moodle_text_filter * @throws dml_exception */ public function filter($text, array $options = array()) { - global $PAGE; + global $CFG, $PAGE; $i = 0; if (stripos($text, '</video>') === false) { @@ -57,7 +57,7 @@ class filter_opencast extends moodle_text_filter foreach (\tool_opencast\local\settings_api::get_ocinstances() as $ocinstance) { $episodeurl = get_config('filter_opencast', 'episodeurl_' . $ocinstance->id); - if(!$episodeurl) { + if (!$episodeurl) { continue; } @@ -122,6 +122,7 @@ class filter_opencast extends moodle_text_filter $mustachedata->data = json_encode($data); $mustachedata->width = $width; $mustachedata->height = $height; + $mustachedata->modplayerpath = (new moodle_url('/mod/opencast/player.html'))->out(); if (count($data['streams']) === 1) { $sources = $data['streams'][0]['sources']; diff --git a/templates/player.mustache b/templates/player.mustache index 1c9d5cf9ec26b2406d1719c7865b67769ac55537..d814c1fccd381574b889da04d52c600e23a30437 100644 --- a/templates/player.mustache +++ b/templates/player.mustache @@ -27,6 +27,7 @@ "height": "250", "playerid": "ocplayer_0", "configurl": "/filter/opencast/config.json", + "modplayerpath": "/mod/opencast/player.html", "data": "{"metadata":{"title": "Test video", "etc": "..."}" } }} @@ -37,7 +38,7 @@ {{^resolution}} <div class="filter-opencast player-wrapper"> {{/resolution}} - <iframe src="/mod/opencast/player.html" class="filter-player-iframe" id="{{playerid}}" allowfullscreen></iframe> + <iframe src="{{modplayerpath}}" class="filter-player-iframe" id="{{playerid}}" allowfullscreen></iframe> </div> <script>