Updates are aborted when seeking
Buffered will not be present in segment info when a segment processing is aborted due to seeking. Make sure bufferedAdditions_ does not error or add incorrect timeline information to the segment in that case.
Showing
2 changed files
with
13 additions
and
0 deletions
... | @@ -228,6 +228,12 @@ videojs.Hls.bufferedAdditions_ = function(original, update) { | ... | @@ -228,6 +228,12 @@ videojs.Hls.bufferedAdditions_ = function(original, update) { |
228 | var result = [], edges = [], | 228 | var result = [], edges = [], |
229 | i, inOriginalRanges; | 229 | i, inOriginalRanges; |
230 | 230 | ||
231 | // if original or update are falsey, return an empty list of | ||
232 | // additions | ||
233 | if (!original || !update) { | ||
234 | return result; | ||
235 | } | ||
236 | |||
231 | // create a sorted array of time range start and end times | 237 | // create a sorted array of time range start and end times |
232 | for (i = 0; i < original.length; i++) { | 238 | for (i = 0; i < original.length; i++) { |
233 | edges.push({ original: true, start: original.start(i) }); | 239 | edges.push({ original: true, start: original.start(i) }); | ... | ... |
... | @@ -2553,4 +2553,11 @@ test('detects time range edges added by updates', function() { | ... | @@ -2553,4 +2553,11 @@ test('detects time range edges added by updates', function() { |
2553 | ], 'detected a non-contiguous addition'); | 2553 | ], 'detected a non-contiguous addition'); |
2554 | }); | 2554 | }); |
2555 | 2555 | ||
2556 | test('treats null buffered ranges as no addition', function() { | ||
2557 | var edges = videojs.Hls.bufferedAdditions_(null, | ||
2558 | videojs.createTimeRange([[0, 11]])); | ||
2559 | |||
2560 | equal(edges.length, 0, 'no additions'); | ||
2561 | }); | ||
2562 | |||
2556 | })(window, window.videojs); | 2563 | })(window, window.videojs); | ... | ... |
-
Please register or sign in to post a comment