aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Hubel2018-12-28 17:38:23 +0100
committerAndreas Hubel2018-12-28 17:38:32 +0100
commit2b78ec78daa0dd4a0d9c9f8a892a3c8faa9d2690 (patch)
tree986a9b16cce5bba8ababacdfcd579511528bdc9d
parent391dccbf84e2c0ecda819db6594c491243fc5df4 (diff)
Add poster image to live stream players
-rw-r--r--model/Stream.php3
-rw-r--r--template/assemblies/player/audio.phtml11
-rw-r--r--template/assemblies/player/dash.phtml4
-rw-r--r--template/assemblies/player/video.phtml1
4 files changed, 13 insertions, 6 deletions
diff --git a/model/Stream.php b/model/Stream.php
index 718ed98..d577df6 100644
--- a/model/Stream.php
+++ b/model/Stream.php
@@ -264,4 +264,7 @@ class Stream
'opus' => 'Opus',
);
}
+ public function getPoster() {
+ return joinpath(['/', 'thumbs', rawurlencode($this->getRoom()->getStream()).'-poster.png']);
+ }
}
diff --git a/template/assemblies/player/audio.phtml b/template/assemblies/player/audio.phtml
index 087b61c..0713f20 100644
--- a/template/assemblies/player/audio.phtml
+++ b/template/assemblies/player/audio.phtml
@@ -1,8 +1,9 @@
-<audio
- autoplay="autoplay"
+<video
preload="auto"
- style="width: 300px;"
- class="mejs"
+ controls="controls"
+ autoplay="autoplay"
+ style="height: 400px; display: block; margin: auto;"
+ poster="<?=h($stream->getPoster())?>"
>
<source
src="<?=h($stream->getAudioUrl('mp3'))?>"
@@ -12,4 +13,4 @@
src="<?=h($stream->getAudioUrl('opus'))?>"
type="audio/opus"
/>
-</audio>
+</video>
diff --git a/template/assemblies/player/dash.phtml b/template/assemblies/player/dash.phtml
index 8e43864..7cc1e38 100644
--- a/template/assemblies/player/dash.phtml
+++ b/template/assemblies/player/dash.phtml
@@ -2,7 +2,8 @@
<script type="text/javascript" src="<?=h($assets)?>clapprio/level-selector.min.js"></script>
<script type="text/javascript" src="<?=h($assets)?>clapprio/audio-selector.min.js"></script>
-<div class="dashContainer">
+
+<div class="dashContainer" style="min-height: 100px" >
<div id="player"></div>
</div>
@@ -44,6 +45,7 @@
return new Clappr.Player({
sources: sources,
width: "100%",
+ poster: "<?=h($stream->getPoster())?>",
plugins: [DashShakaPlayback, LevelSelector, AudioSelector],
shakaConfiguration: {
abr: {
diff --git a/template/assemblies/player/video.phtml b/template/assemblies/player/video.phtml
index ff5039b..3eae170 100644
--- a/template/assemblies/player/video.phtml
+++ b/template/assemblies/player/video.phtml
@@ -10,6 +10,7 @@
preload="auto"
width="<?=h($stream->getVideoWidth())?>"
height="<?=h($stream->getVideoHeight())?>"
+ poster="<?=h($stream->getPoster())?>"
style="width: 100%; height: 100%;"
class="mejs"
>