Fix language preference being reset on episode switch

This commit is contained in:
Zoe Roux 2026-04-08 11:57:06 +02:00
parent 1a989589aa
commit 65bb461eac
No known key found for this signature in database

View File

@ -44,11 +44,11 @@ export const useLanguagePreference = (player: VideoPlayer, slug: string) => {
forced: false,
});
useEvent(player, "onTrackChange", (s) => {
if (!subtitles?.length) return;
if (!s) {
sub.current = { idx: null, lang: null, forced: false };
return;
}
if (!subtitles?.length) return;
const idx = player.getAvailableTextTracks().findIndex((x) => x.selected);
sub.current = {
idx: idx,