From 2487ef892c73445b7a8fb3f6536155a5b132edf5 Mon Sep 17 00:00:00 2001 From: tapframe Date: Sat, 5 Jul 2025 13:35:36 +0530 Subject: [PATCH] Enhance video player components by adding zoom scale support and updating aspect ratio options. Introduce online subtitles section in SubtitleModals for improved subtitle management. --- src/components/player/AndroidVideoPlayer.tsx | 3 +- src/components/player/VideoPlayer.tsx | 1 + .../player/modals/SubtitleModals.tsx | 65 +++++++++++++++++++ .../player/subtitles/CustomSubtitles.tsx | 13 +++- 4 files changed, 80 insertions(+), 2 deletions(-) diff --git a/src/components/player/AndroidVideoPlayer.tsx b/src/components/player/AndroidVideoPlayer.tsx index b202a6f83..8e69effe0 100644 --- a/src/components/player/AndroidVideoPlayer.tsx +++ b/src/components/player/AndroidVideoPlayer.tsx @@ -530,7 +530,7 @@ const AndroidVideoPlayer: React.FC = () => { const cycleAspectRatio = () => { // Android: cycle through native resize modes - const resizeModes: ResizeModeType[] = ['contain', 'cover', 'stretch', 'none']; + const resizeModes: ResizeModeType[] = ['contain', 'cover', 'fill', 'none']; const currentIndex = resizeModes.indexOf(resizeMode); const nextIndex = (currentIndex + 1) % resizeModes.length; setResizeMode(resizeModes[nextIndex]); @@ -1091,6 +1091,7 @@ const AndroidVideoPlayer: React.FC = () => { useCustomSubtitles={useCustomSubtitles} currentSubtitle={currentSubtitle} subtitleSize={subtitleSize} + zoomScale={zoomScale} /> { useCustomSubtitles={useCustomSubtitles} currentSubtitle={currentSubtitle} subtitleSize={subtitleSize} + zoomScale={zoomScale} /> = ({ ))} + + {/* Online subtitles section */} + {isLoadingSubtitleList && ( + + + + )} + + {availableSubtitles.length > 0 && ( + <> + + + Online Subtitles + + + + {availableSubtitles.map((sub) => ( + + { + loadWyzieSubtitle(sub); + handleLanguageClose(); + }} + activeOpacity={0.85} + > + + + + {sub.display} + + + + + + + + + + ))} + + )} diff --git a/src/components/player/subtitles/CustomSubtitles.tsx b/src/components/player/subtitles/CustomSubtitles.tsx index 66bbedf6f..ea8df40ac 100644 --- a/src/components/player/subtitles/CustomSubtitles.tsx +++ b/src/components/player/subtitles/CustomSubtitles.tsx @@ -6,17 +6,28 @@ interface CustomSubtitlesProps { useCustomSubtitles: boolean; currentSubtitle: string; subtitleSize: number; + zoomScale?: number; // current video zoom scale; defaults to 1 } export const CustomSubtitles: React.FC = ({ useCustomSubtitles, currentSubtitle, subtitleSize, + zoomScale = 1, }) => { if (!useCustomSubtitles || !currentSubtitle) return null; + const inverseScale = 1 / zoomScale; return ( - + {currentSubtitle}