1
0
Fork 0
forked from mirror/cinny

fix negative audio duration info crash react-range (#1701)

This commit is contained in:
Ajay Bura 2024-04-24 18:12:52 +05:30 committed by GitHub
parent 372d4d5c34
commit 8c5a1d15cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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);