From c02baf2831e48a11981161441d6ab8591087d8ce Mon Sep 17 00:00:00 2001 From: Gauvain Date: Tue, 30 Jun 2026 01:41:21 +0200 Subject: [PATCH] fix(subtitles): rebuild track callbacks when isCurrentSubImageBased changes The setTrack/Disable callbacks close over isCurrentSubImageBased for the transcode replacePlayer decision; add it to the track-building effect deps so they rebuild when it flips (otherwise, in a transcoding session, callbacks could stay on the MPV path after switching to/from a burned-in image sub and the player would not refresh). Addresses CodeRabbit. --- components/video-player/controls/contexts/VideoContext.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/video-player/controls/contexts/VideoContext.tsx b/components/video-player/controls/contexts/VideoContext.tsx index 130b4749..fd1b9b71 100644 --- a/components/video-player/controls/contexts/VideoContext.tsx +++ b/components/video-player/controls/contexts/VideoContext.tsx @@ -360,8 +360,10 @@ export const VideoProvider: React.FC<{ children: ReactNode }> = ({ }; fetchTracks(); - // api?.basePath: the setTrack callbacks build external-sub URLs from it; rebuild - // them once the API is ready so online externals don't resolve with undefined. + // api?.basePath: setTrack builds external-sub URLs from it — rebuild once the + // API is ready so online externals don't resolve with undefined. + // isCurrentSubImageBased: setTrack closes over it for the transcode replacePlayer + // decision — rebuild when it flips so we refresh the stream when we should. }, [ tracksReady, mediaSource, @@ -369,6 +371,7 @@ export const VideoProvider: React.FC<{ children: ReactNode }> = ({ downloadedItem, itemId, api?.basePath, + isCurrentSubImageBased, ]); return (