summaryrefslogtreecommitdiffstats
path: root/templates/video-player.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/video-player.html')
-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>