Make durationchange consistent
Fire durationchange after the seekable range has been modified whether the MediaSource is ready immediately or the modification needs to occur after the current update finishes.
Showing
1 changed file
with
2 additions
and
2 deletions
... | @@ -492,12 +492,12 @@ videojs.HlsHandler.prototype.updateDuration = function(playlist) { | ... | @@ -492,12 +492,12 @@ videojs.HlsHandler.prototype.updateDuration = function(playlist) { |
492 | newDuration = videojs.Hls.Playlist.duration(playlist), | 492 | newDuration = videojs.Hls.Playlist.duration(playlist), |
493 | setDuration = function() { | 493 | setDuration = function() { |
494 | this.mediaSource.duration = newDuration; | 494 | this.mediaSource.duration = newDuration; |
495 | this.tech_.trigger('durationchange'); | ||
496 | |||
497 | // update seekable | 495 | // update seekable |
498 | if (seekable.length !== 0 && newDuration === Infinity) { | 496 | if (seekable.length !== 0 && newDuration === Infinity) { |
499 | this.mediaSource.addSeekableRange_(seekable.start(0), seekable.end(0)); | 497 | this.mediaSource.addSeekableRange_(seekable.start(0), seekable.end(0)); |
500 | } | 498 | } |
499 | this.tech_.trigger('durationchange'); | ||
500 | |||
501 | this.mediaSource.removeEventListener('sourceopen', setDuration); | 501 | this.mediaSource.removeEventListener('sourceopen', setDuration); |
502 | }.bind(this), | 502 | }.bind(this), |
503 | seekable = this.seekable(); | 503 | seekable = this.seekable(); | ... | ... |
-
Please register or sign in to post a comment