diff src/VideoPage.ts @ 49:1bd17c2e5517 default tip

video.py must sign video urls for serve-files.js to serve them
author drewp@bigasterisk.com
date Fri, 06 Dec 2024 17:13:51 -0800
parents 046673b1cc24
children
line wrap: on
line diff
--- a/src/VideoPage.ts	Fri Dec 06 14:20:11 2024 -0800
+++ b/src/VideoPage.ts	Fri Dec 06 17:13:51 2024 -0800
@@ -14,6 +14,10 @@
   label: string;
 }
 
+interface AutoplayVideoFile extends VideoFile {
+  sig: string;
+}
+
 interface Subdir {
   label: string;
   path: string;
@@ -24,7 +28,7 @@
   dirLabel: string;
   videos: VideoFile[];
   subdirs: Subdir[];
-  autoplay: VideoFile | null;
+  autoplay: AutoplayVideoFile | null;
 }
 
 function subdirQuery(subdir: string): string {
@@ -178,9 +182,9 @@
     return this.shadowRoot!.querySelector("#scrim")!;
   }
 
-  async startPlayer(p: VideoFile) {
+  async startPlayer(p: AutoplayVideoFile) {
     const player = await this.pagePlayer;
-    player.manifest = this.escapeALittle(PATH_PREFIX + "/files" + p.webDataPath);
+    player.manifest = PATH_PREFIX + "/files" + this.escapeALittle(p.webDataPath) + "?sig=" + encodeURIComponent(p.sig);
     const sv = player.shadowRoot!.querySelector("shaka-video")! as ShakaVideoElement;
 
     sv.src = player.manifest;