diff --git a/lib/media/media_source_engine.js b/lib/media/media_source_engine.js index 5c0187d1cb..93fe06ecf3 100644 --- a/lib/media/media_source_engine.js +++ b/lib/media/media_source_engine.js @@ -673,8 +673,7 @@ shaka.media.MediaSourceEngine = class { * @return {?number} The timestamp in seconds, or null if nothing is buffered. */ bufferStart(contentType) { - if (this.reloadingMediaSource_ || - !Object.keys(this.sourceBuffers_).length) { + if (!Object.keys(this.sourceBuffers_).length) { return null; } const ContentType = shaka.util.ManifestParserUtils.ContentType; @@ -692,7 +691,7 @@ shaka.media.MediaSourceEngine = class { * @return {?number} The timestamp in seconds, or null if nothing is buffered. */ bufferEnd(contentType) { - if (this.reloadingMediaSource_) { + if (!Object.keys(this.sourceBuffers_).length) { return null; } const ContentType = shaka.util.ManifestParserUtils.ContentType; @@ -712,9 +711,6 @@ shaka.media.MediaSourceEngine = class { * @return {boolean} */ isBuffered(contentType, time) { - if (this.reloadingMediaSource_) { - return false; - } const ContentType = shaka.util.ManifestParserUtils.ContentType; if (contentType == ContentType.TEXT) { return this.textEngine_.isBuffered(time); @@ -733,9 +729,6 @@ shaka.media.MediaSourceEngine = class { * @return {number} The amount of time buffered ahead in seconds. */ bufferedAheadOf(contentType, time) { - if (this.reloadingMediaSource_) { - return 0; - } const ContentType = shaka.util.ManifestParserUtils.ContentType; if (contentType == ContentType.TEXT) { return this.textEngine_.bufferedAheadOf(time); @@ -756,9 +749,9 @@ shaka.media.MediaSourceEngine = class { const info = { total: this.reloadingMediaSource_ ? [] : TimeRangesUtils.getBufferedInfo(this.video_.buffered), - audio: this.reloadingMediaSource_ ? [] : + audio: TimeRangesUtils.getBufferedInfo(this.getBuffered_(ContentType.AUDIO)), - video: this.reloadingMediaSource_ ? [] : + video: TimeRangesUtils.getBufferedInfo(this.getBuffered_(ContentType.VIDEO)), text: [], }; @@ -781,6 +774,9 @@ shaka.media.MediaSourceEngine = class { * @private */ getBuffered_(contentType) { + if (this.reloadingMediaSource_) { + return null; + } try { return this.sourceBuffers_[contentType].buffered; } catch (exception) {