0de3d793 by David LaPalomento

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.
1 parent 5b501b00
......@@ -228,6 +228,12 @@ videojs.Hls.bufferedAdditions_ = function(original, update) {
var result = [], edges = [],
i, inOriginalRanges;
// if original or update are falsey, return an empty list of
// additions
if (!original || !update) {
return result;
}
// create a sorted array of time range start and end times
for (i = 0; i < original.length; i++) {
edges.push({ original: true, start: original.start(i) });
......
......@@ -2553,4 +2553,11 @@ test('detects time range edges added by updates', function() {
], 'detected a non-contiguous addition');
});
test('treats null buffered ranges as no addition', function() {
var edges = videojs.Hls.bufferedAdditions_(null,
videojs.createTimeRange([[0, 11]]));
equal(edges.length, 0, 'no additions');
});
})(window, window.videojs);
......