fe517c0e by jforbes

Added an extra null check for mediaSource

1 parent 6a9433a9
......@@ -892,6 +892,7 @@ var 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([]);
}
......
......@@ -739,6 +739,13 @@ test('always returns an empty buffered region when there are no SourceBuffers',
equal(player.tech_.hls.findBufferedRange_().length,
0,
'empty TimeRanges returned');
// Simulate the condition with no media source
player.hls.mediaSource.mediaSource_ = undefined;
equal(player.tech_.hls.findBufferedRange_().length,
0,
'empty TimeRanges returned');
});
test('finds the correct buffered region based on currentTime', function() {
......