From b6b2ed037988e979bd74f5f3496b1cdf18ee4c28 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Wed, 16 Aug 2023 15:27:25 +0200 Subject: [PATCH] Media Viewer: Patch `playbackRate` exception --- src/global/actions/ui/mediaViewer.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/global/actions/ui/mediaViewer.ts b/src/global/actions/ui/mediaViewer.ts index 212c2f5ea..601a9b182 100644 --- a/src/global/actions/ui/mediaViewer.ts +++ b/src/global/actions/ui/mediaViewer.ts @@ -3,6 +3,7 @@ import type { ActionReturnType } from '../../types'; import { updateTabState } from '../../reducers/tabs'; import { selectTabState } from '../../selectors'; import { getCurrentTabId } from '../../../util/establishMultitabRole'; +import { DEFAULT_PLAYBACK_RATE } from '../../../config'; addActionHandler('openMediaViewer', (global, actions, payload): ActionReturnType => { const { @@ -11,6 +12,7 @@ addActionHandler('openMediaViewer', (global, actions, payload): ActionReturnType } = payload; const tabState = selectTabState(global, tabId); + return updateTabState(global, { mediaViewer: { ...tabState.mediaViewer, @@ -22,7 +24,12 @@ addActionHandler('openMediaViewer', (global, actions, payload): ActionReturnType origin, isHidden: false, volume: volume ?? tabState.mediaViewer.volume, - playbackRate: playbackRate || tabState.mediaViewer.playbackRate || global.mediaViewer.lastPlaybackRate, + playbackRate: ( + playbackRate + || tabState.mediaViewer.playbackRate + || global.mediaViewer.lastPlaybackRate + || DEFAULT_PLAYBACK_RATE + ), isMuted: isMuted || tabState.mediaViewer.isMuted, }, forwardMessages: {},