Fix(ts): crash seeking to null (#3802)

* fix: avoid crash when seeking to null
This commit is contained in:
Olivier Bouillet 2024-05-21 22:15:47 +02:00 committed by GitHub
parent e16730de11
commit c80164ccdf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -233,8 +233,8 @@ const Video = forwardRef<VideoRef, ReactVideoProps>(
}, [selectedVideoTrack]);
const seek = useCallback(async (time: number, tolerance?: number) => {
if (isNaN(time)) {
throw new Error('Specified time is not a number');
if (isNaN(time) || time === null) {
throw new Error("Specified time is not a number: '" + time + "'");
}
if (!nativeRef.current) {