Skip to content

Commit

Permalink
fix: nan timer while buffering
Browse files Browse the repository at this point in the history
  • Loading branch information
amar-1995 authored Feb 29, 2024
1 parent 8de4c43 commit 943e15c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 943e15c

Please sign in to comment.