From 165530833bfd9f3b6fcc99dd55cca2e74caf8c61 Mon Sep 17 00:00:00 2001 From: Someshwar Tripathi Date: Tue, 20 Aug 2024 10:02:14 +0530 Subject: [PATCH 1/2] Add video playback speeds --- src/CONST.ts | 2 +- .../VideoPlayerContexts/VideoPopoverMenuContext.tsx | 4 ++-- src/languages/en.ts | 1 + src/languages/es.ts | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index b31bcc424c8..0017c8b81b6 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -4171,7 +4171,7 @@ const CONST = { VIDEO_PLAYER: { POPOVER_Y_OFFSET: -30, - PLAYBACK_SPEEDS: [0.25, 0.5, 1, 1.5, 2], + PLAYBACK_SPEEDS: [0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2], HIDE_TIME_TEXT_WIDTH: 250, MIN_WIDTH: 170, MIN_HEIGHT: 120, diff --git a/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx b/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx index bb2b2e24aea..ca161964de2 100644 --- a/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx +++ b/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx @@ -15,7 +15,7 @@ const Context = React.createContext(null); function VideoPopoverMenuContextProvider({children}: ChildrenProps) { const {currentlyPlayingURL} = usePlaybackContext(); const {translate} = useLocalize(); - const [currentPlaybackSpeed, setCurrentPlaybackSpeed] = useState(CONST.VIDEO_PLAYER.PLAYBACK_SPEEDS[2]); + const [currentPlaybackSpeed, setCurrentPlaybackSpeed] = useState(CONST.VIDEO_PLAYER.PLAYBACK_SPEEDS[3]); const {isOffline} = useNetwork(); const isLocalFile = currentlyPlayingURL && CONST.ATTACHMENT_LOCAL_URL_PREFIX.some((prefix) => currentlyPlayingURL.startsWith(prefix)); const videoPopoverMenuPlayerRef = useRef(null); @@ -57,7 +57,7 @@ function VideoPopoverMenuContextProvider({children}: ChildrenProps) { text: translate('videoPlayer.playbackSpeed'), subMenuItems: CONST.VIDEO_PLAYER.PLAYBACK_SPEEDS.map((speed) => ({ icon: currentPlaybackSpeed === speed ? Expensicons.Checkmark : undefined, - text: speed.toString(), + text: speed === 1 ? CONST.VIDEO_PLAYER.NORMAL_SPEED : speed.toString(), onSelected: () => { updatePlaybackSpeed(speed); }, diff --git a/src/languages/en.ts b/src/languages/en.ts index d726b244688..72fd09958e4 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -4169,6 +4169,7 @@ export default { expand: 'Expand', mute: 'Mute', unmute: 'Unmute', + normal: 'Normal', }, exitSurvey: { header: 'Before you go', diff --git a/src/languages/es.ts b/src/languages/es.ts index a8d4ccba22e..67e19c7db1a 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -4686,6 +4686,7 @@ export default { expand: 'Expandir', mute: 'Silenciar', unmute: 'Activar sonido', + normal: 'Normal', }, exitSurvey: { header: 'Antes de irte', From dd4430d4bc7354858dd7588f1eccd362ad1e9eb2 Mon Sep 17 00:00:00 2001 From: Someshwar Tripathi Date: Tue, 20 Aug 2024 10:06:17 +0530 Subject: [PATCH 2/2] Display 'Normal' for 1x speed --- src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx b/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx index ca161964de2..966f49e45a9 100644 --- a/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx +++ b/src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx @@ -57,7 +57,7 @@ function VideoPopoverMenuContextProvider({children}: ChildrenProps) { text: translate('videoPlayer.playbackSpeed'), subMenuItems: CONST.VIDEO_PLAYER.PLAYBACK_SPEEDS.map((speed) => ({ icon: currentPlaybackSpeed === speed ? Expensicons.Checkmark : undefined, - text: speed === 1 ? CONST.VIDEO_PLAYER.NORMAL_SPEED : speed.toString(), + text: speed === 1 ? translate('videoPlayer.normal') : speed.toString(), onSelected: () => { updatePlaybackSpeed(speed); },