JavascriptSubtitlesOctopus
JavascriptSubtitlesOctopus copied to clipboard
Allow updating the available font list
If I initialize an instance with the subUrl option and a given font, JSO renders fine.
However, if I use setTrack with another font, the render is not updated to use the new font. The text and other style properties are updated, just not the font.
Both fonts have been specified in the availableFonts option.
Currently the only workaround I have is to dispose and reinitialize JSO.
iinm, availableFonts is currently only sent to the worker on init, meaning later changes have no effect.
So I guess this is a feature request to allow adding new fonts and possibly removing old fonts later on (which seems reasonable).
I think you misunderstand the bug. What I'm running into is: I initialize JSO with availableFonts: {"font 1": "/path/to/font1.ttf", "font 2": "/path/to/font2.ttf"} and a subUrl that only uses font 1. Later on, I use setTrack to specify a new subtitles file that only uses font2. This should switch to font 2 in the rendering, but it does not. I do not want to change the value of availableFonts, I want to be able to change which fonts are used in the subtitles.
Here's a detailed timeline of the bug I notice:
- I run
setTrack(font2subs)(the subs are a data url, not http, if that makes any difference) - I notice a network request to fetch the font 2 ttf file, but the rendering does not change.
- I run
setTrack(font1subs)and it changes back to font 1 instantly - I run
setTrack(font2subs)and it changes back to font 2 instantly.
So it seems that, when the font changes, if it has to download the font, it forgets to refresh the render after it downloads.
I think you misunderstand the bug. What I'm running into is: I initialize JSO with
availableFonts: {"font 1": "/path/to/font1.ttf", "font 2": "/path/to/font2.ttf"}and asubUrlthat only uses font 1. Later on, I usesetTrackto specify a new subtitles file that only uses font2. This should switch to font 2 in the rendering, but it does not. I do not want to change the value ofavailableFonts, I want to be able to change which fonts are used in the subtitles.Here's a detailed timeline of the bug I notice:
- I run
setTrack(font2subs)(the subs are a data url, not http, if that makes any difference)- I notice a network request to fetch the font 2 ttf file, but the rendering does not change.
- I run
setTrack(font1subs)and it changes back to font 1 instantly- I run
setTrack(font2subs)and it changes back to font 2 instantly.So it seems that, when the font changes, if it has to download the font, it forgets to refresh the render after it downloads.
@incidentist Encountered the same problem 😄, have you solved it?