From 1cfd0135846f02cfd97feb5a4ba3faa11749ea45 Mon Sep 17 00:00:00 2001 From: brandonocasey Date: Tue, 26 Feb 2019 17:17:21 -0500 Subject: [PATCH] fix: only fire seekablechange on a change --- src/master-playlist-controller.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/master-playlist-controller.js b/src/master-playlist-controller.js index 2b6b45e6c..d0717c095 100644 --- a/src/master-playlist-controller.js +++ b/src/master-playlist-controller.js @@ -922,6 +922,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 @@ -939,6 +947,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');