From 1c9f02ba8ef8538264bafecd00dcb0cd77095890 Mon Sep 17 00:00:00 2001 From: Pas <74743263+Pasithea0@users.noreply.github.com> Date: Mon, 10 Nov 2025 13:45:05 -0700 Subject: [PATCH] fix native captions being initialized wrong for mp4 --- src/components/player/hooks/useCaptions.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/player/hooks/useCaptions.ts b/src/components/player/hooks/useCaptions.ts index 00a0d331..20b8d72c 100644 --- a/src/components/player/hooks/useCaptions.ts +++ b/src/components/player/hooks/useCaptions.ts @@ -4,6 +4,7 @@ import subsrt from "subsrt-ts"; import { downloadCaption, downloadWebVTT } from "@/backend/helpers/subs"; import { Caption } from "@/stores/player/slices/source"; import { usePlayerStore } from "@/stores/player/store"; +import { usePreferencesStore } from "@/stores/preferences"; import { useSubtitleStore } from "@/stores/subtitles"; import { @@ -30,6 +31,9 @@ export function useCaptions() { (s) => s.display?.setSubtitlePreference, ); const setCaptionAsTrack = usePlayerStore((s) => s.setCaptionAsTrack); + const enableNativeSubtitles = usePreferencesStore( + (s) => s.enableNativeSubtitles, + ); const captions = useMemo( () => @@ -86,8 +90,11 @@ export function useCaptions() { setLanguage(caption.language); // Use native tracks for MP4 streams instead of custom rendering - if (source?.type === "file") { + if (source?.type === "file" && enableNativeSubtitles) { setCaptionAsTrack(true); + } else { + // For HLS sources or when native subtitles are disabled, use custom rendering + setCaptionAsTrack(false); } }, [ @@ -100,6 +107,7 @@ export function useCaptions() { setSubtitlePreference, source, setCaptionAsTrack, + enableNativeSubtitles, ], );