Fix video and audio playback to pause on window close

This commit is contained in:
ayumi-signal 2024-02-02 15:39:32 -08:00 committed by GitHub
parent d215e1b9be
commit 96131112da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 98 additions and 1 deletions

View file

@ -21,6 +21,7 @@ import {
getMedia,
getHasPrevMessage,
getHasNextMessage,
getPlaybackDisabled,
getSelectedIndex,
shouldShowLightbox,
} from '../selectors/lightbox';
@ -50,6 +51,7 @@ export function SmartLightbox(): JSX.Element | null {
const hasPrevMessage = useSelector<StateType, boolean>(getHasPrevMessage);
const hasNextMessage = useSelector<StateType, boolean>(getHasNextMessage);
const selectedIndex = useSelector<StateType, number>(getSelectedIndex);
const playbackDisabled = useSelector<StateType, boolean>(getPlaybackDisabled);
const onPrevAttachment = useCallback(() => {
if (selectedIndex <= 0) {
@ -93,6 +95,7 @@ export function SmartLightbox(): JSX.Element | null {
i18n={i18n}
isViewOnce={isViewOnce}
media={media}
playbackDisabled={playbackDisabled}
saveAttachment={saveAttachment}
selectedIndex={selectedIndex || 0}
toggleForwardMessagesModal={toggleForwardMessagesModal}