fix: toggling ssubtitles not working
This commit is contained in:
2 files changed
+17
-5
No files matched your search
@@ -333,6 +333,8 @@ function VideoPlayer() {
|
||||
}, [item?.Id]);
|
||||
|
||||
useEffect(() => {
|
||||
console.log(mediaSource.subtitle.enable);
|
||||
|
||||
if (player.current?.getInternalPlayer() && mediaSource.subtitle.enable) {
|
||||
let jassubRenderer: JASSUB | undefined;
|
||||
if (
|
||||
@@ -368,6 +370,17 @@ function VideoPlayer() {
|
||||
} // Remove JASSUB renderer when track changes to fix duplicate renders
|
||||
};
|
||||
}
|
||||
if (
|
||||
player.current?.getInternalPlayer() &&
|
||||
mediaSource.subtitle.enable === false
|
||||
) {
|
||||
// @ts-ignore internalPlayer here provides the HTML video player element
|
||||
const videoElem: HTMLMediaElement =
|
||||
player.current.getInternalPlayer() as HTMLMediaElement;
|
||||
for (const i of videoElem.textTracks) {
|
||||
i.mode = "hidden";
|
||||
}
|
||||
}
|
||||
}, [
|
||||
mediaSource.subtitle.track,
|
||||
mediaSource.subtitle.enable,
|
||||
@@ -584,10 +597,9 @@ function VideoPlayer() {
|
||||
) => {
|
||||
startSubtitleChange(() => {
|
||||
if (mediaSource.subtitle.allTracks) {
|
||||
changeSubtitleTrack(
|
||||
toNumber(e.target.value),
|
||||
mediaSource.subtitle.allTracks,
|
||||
);
|
||||
changeSubtitleTrack(toNumber(e.target.value), mediaSource.subtitle.allTracks);
|
||||
console.log(mediaSource.subtitle);
|
||||
setSettingsMenu(null);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user