diff --git a/components/ILIAS/UI/src/Implementation/Component/Player/Renderer.php b/components/ILIAS/UI/src/Implementation/Component/Player/Renderer.php
index f0c2d790527d..9489d4788a3e 100755
--- a/components/ILIAS/UI/src/Implementation/Component/Player/Renderer.php
+++ b/components/ILIAS/UI/src/Implementation/Component/Player/Renderer.php
@@ -1,7 +1,5 @@
getTemplate("tpl.audio.html", true, true);
- $component = $component->withAdditionalOnLoadCode(function ($id) {
- return "$('#$id').mediaelementplayer({stretching: 'responsive'});";
- });
$id = $this->bindJavaScript($component);
if ($component->getTranscription() != "") {
@@ -75,11 +72,60 @@ public function renderVideo(
Component\Component $component,
RendererInterface $default_renderer
): string {
+ if ($this->isVimeo($component)) {
+ return $this->renderVimeo(
+ $component,
+ $default_renderer
+ );
+ } elseif ($this->isYoutube($component)) {
+ return $this->renderYoutube(
+ $component,
+ $default_renderer
+ );
+ }
+ return $this->renderNative(
+ $component,
+ $default_renderer
+ );
+ }
+
+ public function renderVimeo(
+ Component\Component $component,
+ RendererInterface $default_renderer
+ ): string {
+
+ $tpl = $this->getTemplate("tpl.video_vimeo.html", true, true);
+
+ $id = $this->bindJavaScript($component);
+
+ $tpl->setVariable("ID", $id);
+ $tpl->setVariable("SOURCE", $component->getSource());
+
+ return $tpl->get();
+ }
+
+ public function renderYoutube(
+ Component\Component $component,
+ RendererInterface $default_renderer
+ ): string {
+
+ $tpl = $this->getTemplate("tpl.video_youtube.html", true, true);
+
+ $id = $this->bindJavaScript($component);
+
+ $tpl->setVariable("ID", $id);
+ $tpl->setVariable("SOURCE", $component->getSource());
+
+ return $tpl->get();
+ }
+
+ public function renderNative(
+ Component\Component $component,
+ RendererInterface $default_renderer
+ ): string {
+
$tpl = $this->getTemplate("tpl.video.html", true, true);
- $component = $component->withAdditionalOnLoadCode(function ($id) {
- return "$('#$id').mediaelementplayer();";
- });
$id = $this->bindJavaScript($component);
foreach ($component->getSubtitleFiles() as $lang_key => $file) {
@@ -101,11 +147,21 @@ public function renderVideo(
return $tpl->get();
}
- public function registerResources(\ILIAS\UI\Implementation\Render\ResourceRegistry $registry): void
- {
- parent::registerResources($registry);
- $registry->register('./assets/js/mediaelement-and-player.min.js');
- $registry->register('./assets/css/mediaelementplayer.min.css');
- $registry->register('./assets/js/vimeo.min.js');
+ protected function isVimeo(
+ Component\Component $component
+ ): bool {
+ if (is_int(strpos($component->getSource(), 'vimeo.com'))) {
+ return true;
+ }
+ return false;
+ }
+
+ protected function isYoutube(
+ Component\Component $component
+ ): bool {
+ if (is_int(strpos($component->getSource(), 'youtube.com'))) {
+ return true;
+ }
+ return false;
}
}
diff --git a/components/ILIAS/UI/src/examples/Player/Video/video_vimeo.php b/components/ILIAS/UI/src/examples/Player/Video/video_vimeo.php
index b2e0133f1677..a0dfbda5509c 100755
--- a/components/ILIAS/UI/src/examples/Player/Video/video_vimeo.php
+++ b/components/ILIAS/UI/src/examples/Player/Video/video_vimeo.php
@@ -27,7 +27,7 @@ function video_vimeo(): string
$renderer = $DIC->ui()->renderer();
$f = $DIC->ui()->factory();
- $video = $f->player()->video("https://vimeo.com/669475821?controls=0");
+ $video = $f->player()->video("https://player.vimeo.com/video/669475821");
return $renderer->render($video);
}
diff --git a/components/ILIAS/UI/src/examples/Player/Video/video_youtube.php b/components/ILIAS/UI/src/examples/Player/Video/video_youtube.php
index 78fa66d34419..4a7bbe356d1d 100755
--- a/components/ILIAS/UI/src/examples/Player/Video/video_youtube.php
+++ b/components/ILIAS/UI/src/examples/Player/Video/video_youtube.php
@@ -28,7 +28,7 @@ function video_youtube(): string
$renderer = $DIC->ui()->renderer();
$f = $DIC->ui()->factory();
- $video = $f->player()->video("https://www.youtube.com/watch?v=YSN2osYbshQ");
+ $video = $f->player()->video("https://www.youtube.com/embed/YSN2osYbshQ");
return $renderer->render($video);
}
diff --git a/components/ILIAS/UI/src/templates/default/Player/tpl.audio.html b/components/ILIAS/UI/src/templates/default/Player/tpl.audio.html
index 3efe80c1c2e9..6302eccc951f 100755
--- a/components/ILIAS/UI/src/templates/default/Player/tpl.audio.html
+++ b/components/ILIAS/UI/src/templates/default/Player/tpl.audio.html
@@ -1,5 +1,5 @@
-
+
{BUTTON_AND_MODAL}
diff --git a/components/ILIAS/UI/src/templates/default/Player/tpl.video.html b/components/ILIAS/UI/src/templates/default/Player/tpl.video.html
index c8c5253e69b0..8e7eb44b465b 100755
--- a/components/ILIAS/UI/src/templates/default/Player/tpl.video.html
+++ b/components/ILIAS/UI/src/templates/default/Player/tpl.video.html
@@ -1,5 +1,5 @@
- poster="{POSTER_SOURCE}">
+ poster="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" style="background-image:url('{POSTER_SOURCE}')">
\ No newline at end of file
diff --git a/components/ILIAS/UI/src/templates/default/Player/tpl.video_vimeo.html b/components/ILIAS/UI/src/templates/default/Player/tpl.video_vimeo.html
new file mode 100755
index 000000000000..17b6bcb7ed95
--- /dev/null
+++ b/components/ILIAS/UI/src/templates/default/Player/tpl.video_vimeo.html
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/components/ILIAS/UI/src/templates/default/Player/tpl.video_youtube.html b/components/ILIAS/UI/src/templates/default/Player/tpl.video_youtube.html
new file mode 100755
index 000000000000..17b6bcb7ed95
--- /dev/null
+++ b/components/ILIAS/UI/src/templates/default/Player/tpl.video_youtube.html
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/components/ILIAS/UI/tests/Component/Item/ItemTest.php b/components/ILIAS/UI/tests/Component/Item/ItemTest.php
index c052b250c12b..5ee3546560a5 100755
--- a/components/ILIAS/UI/tests/Component/Item/ItemTest.php
+++ b/components/ILIAS/UI/tests/Component/Item/ItemTest.php
@@ -638,11 +638,12 @@ public function testRenderAudioPlayer(): void
$c = $f->standard("title")->withAudioPlayer($audio);
$html = $r->render($c);
+
$expected = <<
title
EOT;
diff --git a/components/ILIAS/UI/tests/Component/Player/PlayerAudioTest.php b/components/ILIAS/UI/tests/Component/Player/PlayerAudioTest.php
index 6e27779b4cb1..14005b746212 100755
--- a/components/ILIAS/UI/tests/Component/Player/PlayerAudioTest.php
+++ b/components/ILIAS/UI/tests/Component/Player/PlayerAudioTest.php
@@ -100,7 +100,7 @@ public function testRenderAudio(): void
$expected = <<
-
+
EOT;
$this->assertHTMLEquals(
diff --git a/components/ILIAS/UI/tests/Component/Player/PlayerVideoTest.php b/components/ILIAS/UI/tests/Component/Player/PlayerVideoTest.php
index b684c4452c44..c820b69f3313 100755
--- a/components/ILIAS/UI/tests/Component/Player/PlayerVideoTest.php
+++ b/components/ILIAS/UI/tests/Component/Player/PlayerVideoTest.php
@@ -108,7 +108,7 @@ public function testRenderVideo(): void
$html = $r->render($video);
$expected = <<
-
+
EOT;
@@ -126,10 +126,9 @@ public function testRenderWithPoster(): void
$video = $f->video("/foo")->withPoster("bar.jpg");
$html = $r->render($video);
-
$expected = <<
-
+
EOT;
@@ -149,10 +148,50 @@ public function testRenderWithSubtitles(): void
$html = $r->render($video);
$expected = <<
-
+
+EOT;
+ $this->assertHTMLEquals(
+ $this->brutallyTrimHTML($expected),
+ $this->brutallyTrimHTML($html)
+ );
+ }
+
+ public function testRenderYoutube(): void
+ {
+ $f = $this->getFactory();
+ $r = $this->getDefaultRenderer();
+
+ $video = $f->video("https://www.youtube.com/embed/YSN2osYbshQ");
+
+ $html = $r->render($video);
+
+ $expected = <<
+ VIDEO
+
+EOT;
+ $this->assertHTMLEquals(
+ $this->brutallyTrimHTML($expected),
+ $this->brutallyTrimHTML($html)
+ );
+ }
+
+ public function testRenderVimeo(): void
+ {
+ $f = $this->getFactory();
+ $r = $this->getDefaultRenderer();
+
+ $video = $f->video("https://player.vimeo.com/video/669475821");
+
+ $html = $r->render($video);
+
+ $expected = <<
+
+
EOT;
$this->assertHTMLEquals(
$this->brutallyTrimHTML($expected),
diff --git a/templates/default/070-components/UI-framework/Player/_ui-component_player.scss b/templates/default/070-components/UI-framework/Player/_ui-component_player.scss
index c592cad1becd..4ac9903983e7 100755
--- a/templates/default/070-components/UI-framework/Player/_ui-component_player.scss
+++ b/templates/default/070-components/UI-framework/Player/_ui-component_player.scss
@@ -2,6 +2,7 @@
//== Player
$il-player-audio-width: 100%;
+$il-player-audio-height: 30px;
// audio
.il-audio-container {
@@ -10,5 +11,20 @@ $il-player-audio-width: 100%;
}
}
.il-audio-player {
- background: $il-neutral-color;
+ background: transparent;
+ height: $il-player-audio-height;
+ width: $il-player-audio-width;
+}
+.il-video-container {
+ video {
+ background-position: center;
+ background-size: contain;
+ background-repeat: no-repeat;
+ width:100%;
+ }
+ iframe {
+ width:100%;
+ aspect-ratio: 16/9;
+ border:0;
+ }
}
diff --git a/templates/default/delos.css b/templates/default/delos.css
index 411839096d5c..c686ca653742 100644
--- a/templates/default/delos.css
+++ b/templates/default/delos.css
@@ -8271,7 +8271,21 @@ div.alert ul > li:before {
}
.il-audio-player {
- background: #2c2c2c;
+ background: transparent;
+ height: 30px;
+ width: 100%;
+}
+
+.il-video-container video {
+ background-position: center;
+ background-size: contain;
+ background-repeat: no-repeat;
+ width: 100%;
+}
+.il-video-container iframe {
+ width: 100%;
+ aspect-ratio: 16/9;
+ border: 0;
}
.webui-popover-content {