Skip to content

Commit

Permalink
fix: show seekbar in iphone
Browse files Browse the repository at this point in the history
  • Loading branch information
amar-1995 committed Mar 1, 2024
1 parent 0a5031f commit c50f92d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ export const VideoProgress = ({ isDvr = true }: { isDvr: boolean }) => {
if (!videoEl) {
return;
}
const videoProgress = Math.floor(getPercentage(videoEl.currentTime, videoEl.duration));
const duration = isFinite(videoEl.duration) ? videoEl.duration : videoEl.seekable?.end(0) || 0;
const videoProgress = Math.floor(getPercentage(videoEl.currentTime, duration));
let bufferProgress = 0;
if (videoEl.buffered.length > 0) {
bufferProgress = Math.floor(getPercentage(videoEl.buffered?.end(0), videoEl.duration));
bufferProgress = Math.floor(getPercentage(videoEl.buffered?.end(0), duration));
}

setVideoProgress(isNaN(videoProgress) ? 0 : videoProgress);
Expand Down

0 comments on commit c50f92d

Please sign in to comment.