From 316834b0eab74124be389e97510e0c9f24c1eb36 Mon Sep 17 00:00:00 2001 From: Tobias Reischmann <tobias.reischmann@wi.uni-muenster.de> Date: Wed, 19 Sep 2018 16:57:10 +0200 Subject: [PATCH] The repository directly delivers the player url. No need to rebuild it. --- filter.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/filter.php b/filter.php index 44391a7..4cc458a 100644 --- a/filter.php +++ b/filter.php @@ -84,18 +84,15 @@ class filter_opencast extends moodle_text_filter { continue; } - if (strpos($baseurl, 'http') !== 0) { - $baseurl = 'http://' . $baseurl; - } - - // Extract id. - $id = substr($match, strpos($match, 'api/') + 4, 36); - - // Create link to video. - $playerurl = get_config('filter_opencast', 'playerurl'); + // Extract url. + preg_match_all('/<source[^>]+src=([\'"])(?<src>.+?)\1[^>]*>/i', $match, $result); // Change url for loading the (Paella) Player. - $link = $baseurl . $playerurl .'?id=' . $id; + $link = $result['src'][0]; + + if (strpos($link, 'http') !== 0) { + $link = 'http://' . $link; + } // Create source with embedded mode. $src = $link; -- GitLab