fix: bugged subtitle styles

This commit is contained in:
ThaUnknown 2023-04-19 23:53:09 +02:00
parent 87c639d204
commit 3f2bc3e6b4
2 changed files with 3 additions and 4 deletions

View file

@ -137,12 +137,12 @@
chapters = []
currentSkippable = null
completed = false
if (subs) subs.destroy()
current = file
emit('current', current)
if (subs) subs.destroy()
subs = new Subtitles(video, files, current, handleHeaders)
src = file.url
client.send('current', file)
subs = new Subtitles(video, files, current, handleHeaders)
await tick()
video?.play()
}
@ -892,7 +892,6 @@
on:loadedmetadata={findChapters}
on:loadedmetadata={autoPlay}
on:loadedmetadata={checkAudio}
on:loadedmetadata={() => subs?.initSubtitleRenderer()}
on:leavepictureinpicture={() => (pip = false)} />
{#if stats}
<div class='position-absolute top-0 bg-tp p-10 m-15 text-monospace rounded z-50'>

View file

@ -87,6 +87,7 @@ export default class Subtitles {
this.onHeader()
}
}
this.initSubtitleRenderer()
const tracks = this.headers?.filter(t => t)
if (tracks?.length && set.subtitleLanguage) {
if (tracks.length === 1) {
@ -169,7 +170,6 @@ export default class Subtitles {
this.fonts.push(new Uint8Array(set.font.data))
}
this.renderer = new JASSUB(options)
this.selectCaptions(this.current)
}
}