forked from mirror/cinny
fix negative audio duration info crash react-range (#1701)
This commit is contained in:
parent
372d4d5c34
commit
8c5a1d15cb
1 changed files with 2 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue