Skip to content

Commit

Permalink
fix: seekbar not showing in iOS for hls player
Browse files Browse the repository at this point in the history
  • Loading branch information
amar-1995 authored Mar 1, 2024
1 parent 6774ab3 commit 8f12b69
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 = () => {
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 8f12b69

Please sign in to comment.