From 943e15c14b9cf92f4d1521db89c103946d1b10ed Mon Sep 17 00:00:00 2001 From: Amar Bathwal <110378139+amar-1995@users.noreply.github.com> Date: Thu, 29 Feb 2024 18:05:48 +0530 Subject: [PATCH] fix: nan timer while buffering --- .../src/Prebuilt/components/HMSVideo/VideoTime.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/roomkit-react/src/Prebuilt/components/HMSVideo/VideoTime.tsx b/packages/roomkit-react/src/Prebuilt/components/HMSVideo/VideoTime.tsx index b1ef358507..bcd6c3410b 100644 --- a/packages/roomkit-react/src/Prebuilt/components/HMSVideo/VideoTime.tsx +++ b/packages/roomkit-react/src/Prebuilt/components/HMSVideo/VideoTime.tsx @@ -12,7 +12,8 @@ export const VideoTime = () => { const timeupdateHandler = (currentTime: number) => { const videoEl = hlsPlayer?.getVideoElement(); if (videoEl) { - setVideoTime(getDurationFromSeconds(videoEl.duration - currentTime)); + const duration = isFinite(videoEl.duration) ? videoEl.duration : videoEl.seekable.end(0) || 0; + setVideoTime(getDurationFromSeconds(duration - currentTime)); } else { setVideoTime(getDurationFromSeconds(currentTime)); }