Skip to content

Commit db4fb46

Browse files
authored
Merge pull request Expensify#82941 from Uzaifm127/fix/82018
fix: Video pauses after seeking and resumes unexpectedly when clicking on three dots in iOS
2 parents f114ab1 + f609635 commit db4fb46

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/components/VideoPlayer/VideoPlayerControls/ProgressBar/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ function ProgressBar({duration, position, seekPosition}: ProgressBarProps) {
4646

4747
const pan = Gesture.Pan()
4848
.runOnJS(true)
49+
// Reduce gesture threshold so quick taps trigger onFinalize on iOS.
50+
.minDistance(0)
51+
.activateAfterLongPress(0)
4952
.onBegin((event) => {
5053
setIsSliderPressed(true);
5154
checkIfVideoIsPlaying(onCheckIfVideoIsPlaying);

src/components/VideoPlayerContexts/VideoPopoverMenuContext.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ function VideoPopoverMenuContextProvider({children}: ChildrenProps) {
2626
const updatePlaybackSpeed = useCallback(
2727
(speed: PlaybackSpeed) => {
2828
setCurrentPlaybackSpeed(speed);
29-
if (!videoPopoverMenuPlayerRef.current) {
29+
30+
// We check if the player ref exists and if the playback rate is already set to the new speed to avoid redundant updates.
31+
// On iOS, setting the playback rate can cause the video to resume playback if it was paused.
32+
if (!videoPopoverMenuPlayerRef.current || videoPopoverMenuPlayerRef.current.playbackRate === speed) {
3033
return;
3134
}
3235
videoPopoverMenuPlayerRef.current.playbackRate = speed;

0 commit comments

Comments
 (0)