diff --git a/src/components/icons/Pause.tsx b/src/components/icons/Pause.tsx index f83949f06c..3735dadb2f 100644 --- a/src/components/icons/Pause.tsx +++ b/src/components/icons/Pause.tsx @@ -1,9 +1,9 @@ import {createSinglePathSVG} from './TEMPLATE' -export const Pause_Stroke2_Corner0_Rounded = createSinglePathSVG({ +export const Pause_Stroke2_Corner2_Rounded = createSinglePathSVG({ path: 'M4 6a3 3 0 0 1 6 0v12a3 3 0 1 1-6 0V6Zm3-1a1 1 0 0 0-1 1v12a1 1 0 1 0 2 0V6a1 1 0 0 0-1-1Zm7 1a3 3 0 1 1 6 0v12a3 3 0 1 1-6 0V6Zm3-1a1 1 0 0 0-1 1v12a1 1 0 1 0 2 0V6a1 1 0 0 0-1-1Z', }) -export const Pause_Filled_Corner0_Rounded = createSinglePathSVG({ +export const Pause_Filled_Corner2_Rounded = createSinglePathSVG({ path: 'M4 6a3 3 0 0 1 6 0v12a3 3 0 1 1-6 0V6ZM14 6a3 3 0 1 1 6 0v12a3 3 0 1 1-6 0V6Z', }) diff --git a/src/view/com/util/post-embeds/VideoEmbedInner.web.tsx b/src/view/com/util/post-embeds/VideoEmbedInner.web.tsx index b142f3916d..70356eac88 100644 --- a/src/view/com/util/post-embeds/VideoEmbedInner.web.tsx +++ b/src/view/com/util/post-embeds/VideoEmbedInner.web.tsx @@ -1,16 +1,16 @@ import React, {useCallback, useEffect, useRef, useState} from 'react' -import {View} from 'react-native' +import {Pressable, View} from 'react-native' import Animated, {FadeIn, FadeOut} from 'react-native-reanimated' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' import Hls from 'hls.js' import {atoms as a, useTheme} from '#/alf' -import {Button, ButtonIcon} from '#/components/Button' +import {Button} from '#/components/Button' import {useInteractionState} from '#/components/hooks/useInteractionState' import {ArrowsDiagonalOut_Stroke2_Corner2_Rounded as FullscreenIcon} from '#/components/icons/ArrowsDiagonal' import {Mute_Stroke2_Corner0_Rounded as MuteIcon} from '#/components/icons/Mute' -import {Pause_Filled_Corner0_Rounded as PauseIcon} from '#/components/icons/Pause' +import {Pause_Filled_Corner2_Rounded as PauseIcon} from '#/components/icons/Pause' import {Play_Filled_Corner2_Rounded as PlayIcon} from '#/components/icons/Play' import {SpeakerVolumeFull_Stroke2_Corner0_Rounded as UnmuteIcon} from '#/components/icons/Speaker' @@ -202,6 +202,7 @@ function Controls({ onIn: onMouseEnter, onOut: onMouseLeave, } = useInteractionState() + const {state: hasFocus, onIn: onFocus, onOut: onBlur} = useInteractionState() useEffect(() => { if (active) { @@ -219,74 +220,102 @@ function Controls({ } }, [onScreen, pause]) + const onPressPlayPause = useCallback(() => { + if (!focused) { + if (!active) { + setActive() + } + setFocused(true) + } else { + togglePlayPause() + } + }, [togglePlayPause, setActive, setFocused, active, focused]) + return (