function overrideSegmentIndex(stream, segments) {
    const index = new shaka.media.SegmentIndex(segments);
    stream.createSegmentIndex = () => Promise.resolve();
    stream.segmentIndex = index;
  }
@param {shaka.extern.Stream} stream
@param {!Array<shaka.media.SegmentReference>} segments