Skip to content

Commit a4c056e

Browse files
brandonocaseymisteroneill
authored andcommitted
fix: only fire seekablechange when values of seekable ranges actually change (#415)
1 parent b6d1b97 commit a4c056e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/master-playlist-controller.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,14 @@ export class MasterPlaylistController extends videojs.EventTarget {
933933
}
934934
}
935935

936+
let oldEnd;
937+
let oldStart;
938+
939+
if (this.seekable_ && this.seekable_.length) {
940+
oldEnd = this.seekable_.end(0);
941+
oldStart = this.seekable_.start(0);
942+
}
943+
936944
if (!audioSeekable) {
937945
// seekable has been calculated based on buffering video data so it
938946
// can be returned directly
@@ -950,6 +958,13 @@ export class MasterPlaylistController extends videojs.EventTarget {
950958
]]);
951959
}
952960

961+
// seekable is the same as last time
962+
if (this.seekable_ && this.seekable_.length) {
963+
if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) {
964+
return;
965+
}
966+
}
967+
953968
this.logger_(`seekable updated [${Ranges.printableRange(this.seekable_)}]`);
954969

955970
this.tech_.trigger('seekablechanged');

0 commit comments

Comments
 (0)