bufferedAheadOfImpl(type, start) {
    if (!this.segments[type]) {
      throw new Error('unexpected type');
    }

    const ContentType = shaka.util.ManifestParserUtils.ContentType;
    const hasSegment = (i) => {
      return this.segments[type][i] ||
          (type == ContentType.VIDEO && this.segments['trickvideo'] &&
           this.segments['trickvideo'][i]);
    };

    // Note: |start| may equal the end of the last segment, so |first|
    // may equal segments[type].length
    const first = this.toIndex_(type, start);
    if (!hasSegment(first)) {
      return 0;
    }  // Unbuffered.

    // Find the first gap.
    let last = first;
    while (last < this.segments[type].length && hasSegment(last)) {
      last++;
    }

    return this.toTime_(type, last) - start;
  }
@param {string} type
@param {number} start
@return {number}