dcd06fd7 by jrivera

Added a null check. closes #581

1 parent 5ee6cc06
......@@ -323,6 +323,7 @@ const filterBufferedRanges = function(predicate) {
// report a fully empty buffer until SourceBuffers have been created
// which is after a segment has been loaded and transmuxed.
if (!this.mediaSource ||
!this.mediaSource.mediaSource_ ||
!this.mediaSource.mediaSource_.sourceBuffers.length) {
return videojs.createTimeRanges([]);
}
......
......@@ -777,6 +777,13 @@ QUnit.test('always returns an empty buffered region when there are no SourceBuff
QUnit.equal(this.player.tech_.hls.findBufferedRange_().length,
0,
'empty TimeRanges returned');
// Simulate the condition with no media source
delete this.player.hls.mediaSource.mediaSource_;
QUnit.equal(this.player.tech_.hls.findBufferedRange_().length,
0,
'empty TimeRanges returned');
});
QUnit.test('finds the correct buffered region based on currentTime', function() {
......