static computeAddedRange(oldRanges, newRanges) {
    const TimeRangesUtils = shaka.media.TimeRangesUtils;

    if (!oldRanges || !oldRanges.length) {
      return null;
    }
    if (!newRanges || !newRanges.length) {
      return TimeRangesUtils.getBufferedInfo(newRanges).pop();
    }

    const newRangesReversed =
        TimeRangesUtils.getBufferedInfo(newRanges).reverse();
    const oldRangesReversed =
        TimeRangesUtils.getBufferedInfo(oldRanges).reverse();
    for (const newRange of newRangesReversed) {
      let foundOverlap = false;

      for (const oldRange of oldRangesReversed) {
        if (oldRange.end >= newRange.start && oldRange.end <= newRange.end) {
          foundOverlap = true;

          // If the new range goes beyond the corresponding old one, the
          // difference is newly-added.
          if (newRange.end > oldRange.end) {
            return {start: oldRange.end, end: newRange.end};
          }
        }
      }

      if (!foundOverlap) {
        return newRange;
      }
    }

    return null;
  }
This operation can be potentially EXPENSIVE and should only be done in
debug builds for debugging purposes.

@param {TimeRanges} oldRanges
@param {TimeRanges} newRanges
@return {?shaka.extern.BufferedRange} The last added range,
  chronologically by presentation time.