From f09a1853352d0a3e70ce9e86f4e4be05aa0f5e53 Mon Sep 17 00:00:00 2001 From: Ashutosh Shinde Date: Sat, 6 Jan 2024 23:19:06 +0530 Subject: [PATCH] updated selectLanguage callback to call selectCaptionById after searching for correct caption --- src/components/player/hooks/useCaptions.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/components/player/hooks/useCaptions.ts b/src/components/player/hooks/useCaptions.ts index 0f79aa51..424edcad 100644 --- a/src/components/player/hooks/useCaptions.ts +++ b/src/components/player/hooks/useCaptions.ts @@ -35,17 +35,9 @@ export function useCaptions() { async (language: string) => { const caption = captionList.find((v) => v.language === language); if (!caption) return; - const srtData = await downloadCaption(caption); - setCaption({ - id: caption.id, - language: caption.language, - srtData, - url: caption.url, - }); - resetSubtitleSpecificSettings(); - setLanguage(language); + selectCaptionById(caption.id); }, - [setLanguage, captionList, setCaption, resetSubtitleSpecificSettings], + [captionList, selectCaptionById], ); const disable = useCallback(async () => {