changeset 33:6ee4c73decf4

fix playability of vids with # in their titles
author drewp@bigasterisk.com
date Mon, 26 Aug 2024 22:34:28 -0700
parents d83dbda8bccf
children 9edb3df3cdb3
files src/VideoPage.ts
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/VideoPage.ts	Mon Aug 26 22:33:57 2024 -0700
+++ b/src/VideoPage.ts	Mon Aug 26 22:34:28 2024 -0700
@@ -114,16 +114,20 @@
       <page-player manifest=""></page-player>
     `;
   }
+  escapeALittle(fileUri: string) : string {
+    return fileUri.replace('#', encodeURIComponent('#'));
+  }
   playVideo(ev: CustomEvent) {
     const player = this.shadowRoot!.querySelector("page-player")! as PagePlayer;
 
-    player.manifest = ev.detail.manifest;
+    player.manifest = this.escapeALittle(ev.detail.manifest);
     const sv = player.shadowRoot!.querySelector("shaka-video")! as ShakaVideoElement;
 
     sv.src = ev.detail.manifest;
     sv.load().then(() => {
       sv.play();
     });
+    sv.src = player.manifest;
     player.size = "big";
     this.shadowRoot!.querySelector("#scrim")!.style.display = "block";
   }