static getGapIndex(b, time, threshold) {
    const TimeRangesUtils = shaka.media.TimeRangesUtils;

    if (!b || !b.length) {
      return null;
    }
    if (shaka.media.TimeRangesUtils.isBufferNegligible_(b)) {
      return null;
    }

    const idx = TimeRangesUtils.getBufferedInfo(b).findIndex((item, i, arr) => {
      return item.start > time &&
          (i == 0 || arr[i - 1].end - time <= threshold);
    });
    return idx >= 0 ? idx : null;
  }
Determines if the given time is inside a gap between buffered ranges.  If
it is, this returns the index of the buffer that is *ahead* of the gap.

@param {TimeRanges} b
@param {number} time
@param {number} threshold
@return {?number} The index of the buffer after the gap, or null if not in
  a gap.