diff --git a/enjoy/src/i18n/en.json b/enjoy/src/i18n/en.json index 0371f8ddf..177bab95a 100644 --- a/enjoy/src/i18n/en.json +++ b/enjoy/src/i18n/en.json @@ -716,5 +716,7 @@ "displayContent": "Display content", "hideContent": "Hide content", "audioInput": "Audio input", - "textInput": "Text input" + "textInput": "Text input", + "increasePlaybackRate": "Increase playback rate", + "descreasePlaybackRate": "Descrease playback rate" } diff --git a/enjoy/src/i18n/zh-CN.json b/enjoy/src/i18n/zh-CN.json index 63fbf952c..fb77a819d 100644 --- a/enjoy/src/i18n/zh-CN.json +++ b/enjoy/src/i18n/zh-CN.json @@ -716,5 +716,7 @@ "displayContent": "显示内容", "hideContent": "隐藏内容", "audioInput": "语音输入", - "textInput": "文字输入" + "textInput": "文字输入", + "increasePlaybackRate": "加快播放速度", + "decreasePlaybackRate": "减慢播放速度" } diff --git a/enjoy/src/renderer/components/medias/media-player-controls.tsx b/enjoy/src/renderer/components/medias/media-player-controls.tsx index c9ab2bc5f..4a998df49 100644 --- a/enjoy/src/renderer/components/medias/media-player-controls.tsx +++ b/enjoy/src/renderer/components/medias/media-player-controls.tsx @@ -432,6 +432,32 @@ export const MediaPlayerControls = () => { preventDefault: true, } ); + useHotkeys( + currentHotkeys.IncreasePlaybackRate, + () => { + setPlaybackRate( + PLAYBACK_RATE_OPTIONS[ + PLAYBACK_RATE_OPTIONS.indexOf(playbackRate) + 1 + ] ?? playbackRate + ); + }, + { + preventDefault: true, + } + ); + useHotkeys( + currentHotkeys.DecreasePlaybackRate, + () => { + setPlaybackRate( + PLAYBACK_RATE_OPTIONS[ + PLAYBACK_RATE_OPTIONS.indexOf(playbackRate) - 1 + ] ?? playbackRate + ); + }, + { + preventDefault: true, + } + ); /* * Fit zoom ratio when activeRegion is word or segment @@ -514,7 +540,12 @@ export const MediaPlayerControls = () => { -
{t("playbackRate")}
+
+ {t("playbackRate")} +
{PLAYBACK_RATE_OPTIONS.map((rate, i) => (
{ +
+
+ {t("increasePlaybackRate")} +
+ + handleItemSelected({ + name: t("increasePlaybackRate"), + keyName: "IncreasePlaybackRate", + }) + } + className="bg-muted px-2 py-1 rounded-md text-sm text-muted-foreground cursor-pointer" + > + {currentHotkeys.IncreasePlaybackRate} + +
+ + + +
+
+ {t("decreasePlaybackRate")} +
+ + handleItemSelected({ + name: t("decreasePlaybackRate"), + keyName: "DecreasePlaybackRate", + }) + } + className="bg-muted px-2 py-1 rounded-md text-sm text-muted-foreground cursor-pointer" + > + {currentHotkeys.DecreasePlaybackRate} + +
+ + +
{t("compare")} diff --git a/enjoy/src/renderer/context/hotkeys-settings-provider.tsx b/enjoy/src/renderer/context/hotkeys-settings-provider.tsx index 7c9898923..ec8b82b56 100644 --- a/enjoy/src/renderer/context/hotkeys-settings-provider.tsx +++ b/enjoy/src/renderer/context/hotkeys-settings-provider.tsx @@ -53,6 +53,8 @@ const defaultKeyMap = { PlayNextSegment: "N", Compare: "C", PronunciationAssessment: "A", + IncreasePlaybackRate: "]", + DecreasePlaybackRate: "[", // dev tools OpenDevTools: `${ControlOrCommand}+Shift+I`, };