From 3f19c58cf0e063062708d8c788984c4aae87d84e Mon Sep 17 00:00:00 2001 From: Jonny Burger Date: Sat, 8 Feb 2025 17:43:37 +0100 Subject: [PATCH] `@remotion/player`: Show full time when the Player has ended and duration is an integer in seconds --- packages/player/src/PlayerTimeLabel.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/player/src/PlayerTimeLabel.tsx b/packages/player/src/PlayerTimeLabel.tsx index f1450a21118..101e0bab217 100644 --- a/packages/player/src/PlayerTimeLabel.tsx +++ b/packages/player/src/PlayerTimeLabel.tsx @@ -20,9 +20,13 @@ export const PlayerTimeLabel: React.FC<{ }; }, [maxTimeLabelWidth]); + // If the video ended and is not looping, it should show 0:04 / 0:04 instead of 0:03 / 0:04 + const isLastFrame = frame === durationInFrames - 1; + const frameToDisplay = isLastFrame ? frame + 1 : frame; + return (
- {formatTime(frame / fps)} / {formatTime(durationInFrames / fps)} + {formatTime(frameToDisplay / fps)} / {formatTime(durationInFrames / fps)}
); };