From 364472866e9ee0e2aa84ab215c27be9c5e422511 Mon Sep 17 00:00:00 2001
From: Tamara Gunkel <tamara.gunkel@web.de>
Date: Wed, 8 Dec 2021 14:53:16 +0100
Subject: [PATCH] use moodle url for path to mod oc player
---
filter.php | 5 +++--
templates/player.mustache | 3 ++-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/filter.php b/filter.php
index 9dd707a..bc2f708 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 1c9d5cf..d814c1f 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>
--
GitLab