Skip to content

Commit

Permalink
Bugfix: forwardBufferLength calculation (video-dev#4608)
Browse files Browse the repository at this point in the history
  • Loading branch information
hongfeih-es authored Mar 23, 2022
1 parent be09c8c commit 8eb8689
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/controller/latency-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,11 @@ export default class LatencyController implements ComponentAPI {
return 0;
}
const bufferedRanges = media.buffered.length;
return bufferedRanges
? media.buffered.end(bufferedRanges - 1)
: levelDetails.edge - this.currentTime;
return (
(bufferedRanges
? media.buffered.end(bufferedRanges - 1)
: levelDetails.edge) - this.currentTime
);
}

public destroy(): void {
Expand Down

0 comments on commit 8eb8689

Please sign in to comment.