Skip to content

Commit

Permalink
fix: only fire seekablechange when values of seekable ranges actually…
Browse files Browse the repository at this point in the history
… change (#415)
  • Loading branch information
brandonocasey authored and misteroneill committed Mar 5, 2019
1 parent b6d1b97 commit a4c056e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/master-playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -933,6 +933,14 @@ export class MasterPlaylistController extends videojs.EventTarget {
}
}

let oldEnd;
let oldStart;

if (this.seekable_ && this.seekable_.length) {
oldEnd = this.seekable_.end(0);
oldStart = this.seekable_.start(0);
}

if (!audioSeekable) {
// seekable has been calculated based on buffering video data so it
// can be returned directly
Expand All @@ -950,6 +958,13 @@ export class MasterPlaylistController extends videojs.EventTarget {
]]);
}

// seekable is the same as last time
if (this.seekable_ && this.seekable_.length) {
if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) {
return;
}
}

this.logger_(`seekable updated [${Ranges.printableRange(this.seekable_)}]`);

this.tech_.trigger('seekablechanged');
Expand Down

0 comments on commit a4c056e

Please sign in to comment.