Skip to content

Commit

Permalink
fix: prevent wrapping in resetMainLoaderReplaceSegments
Browse files Browse the repository at this point in the history
This fixes a regression introduced in 4590bdd

If the quality is changed during initialization, this function is called. Since `buffered.length` is zero and `buffered` is a `TimeRanges`, `length` (an `unsigned long`) wraps around and becomes 4294967295
  • Loading branch information
pulsejet authored Oct 27, 2023
1 parent beccfa1 commit 577f70d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ export class PlaylistController extends videojs.EventTarget {
*/
resetMainLoaderReplaceSegments() {
const buffered = this.tech_.buffered();
const bufferedEnd = buffered.end(buffered.length - 1);
const bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0;

// Set the replace segments flag to the buffered end, this forces fetchAtBuffer
// on the main loader to remain, false after the resetLoader call, until we have
Expand Down

0 comments on commit 577f70d

Please sign in to comment.