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.
This commit is contained in:
Gauvain
2026-06-30 01:41:21 +02:00
parent 3848877021
commit c02baf2831

View File

@@ -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 (