Added a null check. closes #581
Showing
2 changed files
with
8 additions
and
0 deletions
... | @@ -323,6 +323,7 @@ const filterBufferedRanges = function(predicate) { | ... | @@ -323,6 +323,7 @@ const filterBufferedRanges = function(predicate) { |
323 | // report a fully empty buffer until SourceBuffers have been created | 323 | // report a fully empty buffer until SourceBuffers have been created |
324 | // which is after a segment has been loaded and transmuxed. | 324 | // which is after a segment has been loaded and transmuxed. |
325 | if (!this.mediaSource || | 325 | if (!this.mediaSource || |
326 | !this.mediaSource.mediaSource_ || | ||
326 | !this.mediaSource.mediaSource_.sourceBuffers.length) { | 327 | !this.mediaSource.mediaSource_.sourceBuffers.length) { |
327 | return videojs.createTimeRanges([]); | 328 | return videojs.createTimeRanges([]); |
328 | } | 329 | } | ... | ... |
... | @@ -777,6 +777,13 @@ QUnit.test('always returns an empty buffered region when there are no SourceBuff | ... | @@ -777,6 +777,13 @@ QUnit.test('always returns an empty buffered region when there are no SourceBuff |
777 | QUnit.equal(this.player.tech_.hls.findBufferedRange_().length, | 777 | QUnit.equal(this.player.tech_.hls.findBufferedRange_().length, |
778 | 0, | 778 | 0, |
779 | 'empty TimeRanges returned'); | 779 | 'empty TimeRanges returned'); |
780 | |||
781 | // Simulate the condition with no media source | ||
782 | delete this.player.hls.mediaSource.mediaSource_; | ||
783 | |||
784 | QUnit.equal(this.player.tech_.hls.findBufferedRange_().length, | ||
785 | 0, | ||
786 | 'empty TimeRanges returned'); | ||
780 | }); | 787 | }); |
781 | 788 | ||
782 | QUnit.test('finds the correct buffered region based on currentTime', function() { | 789 | QUnit.test('finds the correct buffered region based on currentTime', function() { | ... | ... |
-
Please register or sign in to post a comment