Mercurial > code > home > repos > video
comparison 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 |
comparison
equal
deleted
inserted
replaced
48:046673b1cc24 | 49:1bd17c2e5517 |
---|---|
12 webRelPath: string; | 12 webRelPath: string; |
13 webDataPath: string; | 13 webDataPath: string; |
14 label: string; | 14 label: string; |
15 } | 15 } |
16 | 16 |
17 interface AutoplayVideoFile extends VideoFile { | |
18 sig: string; | |
19 } | |
20 | |
17 interface Subdir { | 21 interface Subdir { |
18 label: string; | 22 label: string; |
19 path: string; | 23 path: string; |
20 } | 24 } |
21 | 25 |
22 interface PageData { | 26 interface PageData { |
23 webDirRelPath: string; | 27 webDirRelPath: string; |
24 dirLabel: string; | 28 dirLabel: string; |
25 videos: VideoFile[]; | 29 videos: VideoFile[]; |
26 subdirs: Subdir[]; | 30 subdirs: Subdir[]; |
27 autoplay: VideoFile | null; | 31 autoplay: AutoplayVideoFile | null; |
28 } | 32 } |
29 | 33 |
30 function subdirQuery(subdir: string): string { | 34 function subdirQuery(subdir: string): string { |
31 return "subdir=" + encodeURIComponent(subdir); | 35 return "subdir=" + encodeURIComponent(subdir); |
32 } | 36 } |
176 | 180 |
177 getScrim(): HTMLElement { | 181 getScrim(): HTMLElement { |
178 return this.shadowRoot!.querySelector("#scrim")!; | 182 return this.shadowRoot!.querySelector("#scrim")!; |
179 } | 183 } |
180 | 184 |
181 async startPlayer(p: VideoFile) { | 185 async startPlayer(p: AutoplayVideoFile) { |
182 const player = await this.pagePlayer; | 186 const player = await this.pagePlayer; |
183 player.manifest = this.escapeALittle(PATH_PREFIX + "/files" + p.webDataPath); | 187 player.manifest = PATH_PREFIX + "/files" + this.escapeALittle(p.webDataPath) + "?sig=" + encodeURIComponent(p.sig); |
184 const sv = player.shadowRoot!.querySelector("shaka-video")! as ShakaVideoElement; | 188 const sv = player.shadowRoot!.querySelector("shaka-video")! as ShakaVideoElement; |
185 | 189 |
186 sv.src = player.manifest; | 190 sv.src = player.manifest; |
187 sv.autoplay = true; | 191 sv.autoplay = true; |
188 player.size = "big"; | 192 player.size = "big"; |