Skip to content

Commit 77065ac

Browse files
committed
fix: run with time remaining rather than time elapsed for audio att
1 parent 94adb82 commit 77065ac

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

package/src/components/Attachment/Audio/AudioAttachment.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,11 @@ export const AudioAttachment = (props: AudioAttachmentProps) => {
202202

203203
const maxDurationLabel = useMemo(() => getAudioDurationLabel(duration), [duration]);
204204

205+
const remainingDuration = useMemo(() => Math.max(duration - position, 0), [duration, position]);
206+
205207
const progressDuration = useMemo(
206-
() => getAudioDurationLabel(position || duration),
207-
[duration, position],
208+
() => getAudioDurationLabel(remainingDuration || duration),
209+
[duration, remainingDuration],
208210
);
209211

210212
return (

0 commit comments

Comments
 (0)