Skip to content

Commit

Permalink
fix negative audio duration info crash react-range (#1701)
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbura authored Apr 24, 2024
1 parent 372d4d5 commit 8c5a1d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/app/organisms/room/message/AudioContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ export const AudioContent = as<'div', AudioContentProps>(

const [currentTime, setCurrentTime] = useState(0);
// duration in seconds. (NOTE: info.duration is in milliseconds)
const [duration, setDuration] = useState((info.duration ?? 0) / 1000);
const infoDuration = info.duration ?? 0;
const [duration, setDuration] = useState((infoDuration >= 0 ? infoDuration : 0) / 1000);

const getAudioRef = useCallback(() => audioRef.current, []);
const { loading } = useMediaLoading(getAudioRef);
Expand Down

0 comments on commit 8c5a1d1

Please sign in to comment.