summaryrefslogtreecommitdiffstats
path: root/templates/video-player.html
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-07-17 10:04:13 +0100
committerLibravatar cel 🌸 <cel@blos.sm>2024-07-17 10:04:13 +0100
commit2476ed8bd64ea7335b6baf44ec1adbeb5169069c (patch)
treec926bca429ddb8605cc307df84237b188d24d393 /templates/video-player.html
parentfb76f6581f199504e66125dad3f5ca5a7d4c7db6 (diff)
downloadinfoculture.pub-2476ed8bd64ea7335b6baf44ec1adbeb5169069c.tar.gz
infoculture.pub-2476ed8bd64ea7335b6baf44ec1adbeb5169069c.tar.bz2
infoculture.pub-2476ed8bd64ea7335b6baf44ec1adbeb5169069c.zip
genericise video player
Diffstat (limited to '')
-rw-r--r--templates/video-player.html11
1 files changed, 11 insertions, 0 deletions
diff --git a/templates/video-player.html b/templates/video-player.html
new file mode 100644
index 0000000..fd508a8
--- /dev/null
+++ b/templates/video-player.html
@@ -0,0 +1,11 @@
+<video id="media-$id$" class="thumbnail" controls preload="metadata"></video>
+<script type='module'>
+ const torrentId = '$torrent$';
+ const player = document.querySelector('#media-$id$');
+ window.torrentClient.add(torrentId, torrent => {
+ const thumbnail = torrent.files.find(file => file.name.endsWith('.jpg')).streamURL;
+ player.setAttribute("poster", thumbnail);
+ const videofile = torrent.files.find(file => file.name.endsWith('.mp4'));
+ videofile.streamTo(player);
+ });
+</script>