From f3a68368b07f3f91b6e5c719e09e265f9da0c4c1 Mon Sep 17 00:00:00 2001 From: seanmcbroom Date: Tue, 10 Sep 2024 23:35:21 -0500 Subject: [PATCH] refactor: improvements and fixes for jassub rendering --- .../src/components/Playback/PlayerElement.vue | 44 ++++++++++--------- frontend/src/store/player-element.ts | 12 ++++- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/frontend/src/components/Playback/PlayerElement.vue b/frontend/src/components/Playback/PlayerElement.vue index 13d5d5af3b4..e7ca4eb0e9e 100644 --- a/frontend/src/components/Playback/PlayerElement.vue +++ b/frontend/src/components/Playback/PlayerElement.vue @@ -4,27 +4,29 @@ :to="videoContainerRef" :disabled="!videoContainerRef" defer> - - - - +
+ + + + +
diff --git a/frontend/src/store/player-element.ts b/frontend/src/store/player-element.ts index 987bc6143f6..aded6611888 100644 --- a/frontend/src/store/player-element.ts +++ b/frontend/src/store/player-element.ts @@ -124,13 +124,21 @@ class PlayerElementStore extends CommonStore { && mediaElementRef.value && mediaElementRef.value instanceof HTMLVideoElement ) { + const hasAttachedFonts = !isNil(attachedFonts) && attachedFonts.length !== 0; + this._jassub = new JASSUB({ video: mediaElementRef.value, subUrl: trackSrc, - fonts: attachedFonts, + ...(hasAttachedFonts + ? { + fonts: attachedFonts + } + : { + useLocalFonts: true + }), + fallbackFont: DEFAULT_TYPOGRAPHY, workerUrl: jassubWorker, wasmUrl: jassubWasmUrl, - fallbackFont: DEFAULT_TYPOGRAPHY, // Both parameters needed for subs to work on iOS prescaleFactor: 0.8, onDemandRender: false,