createMediaState_(stream) {
    /** @type {!shaka.media.StreamingEngine.MediaState_} */
    const mediaState = {
      stream,
      type: /** @type {shaka.util.ManifestParserUtils.ContentType} */(
        stream.type),
      segmentIterator: null,
      segmentPrefetch: this.createSegmentPrefetch_(stream),
      lastSegmentReference: null,
      lastInitSegmentReference: null,
      lastTimestampOffset: null,
      lastAppendWindowStart: null,
      lastAppendWindowEnd: null,
      lastCodecs: null,
      lastMimeType: null,
      restoreStreamAfterTrickPlay: null,
      endOfStream: false,
      performingUpdate: false,
      updateTimer: null,
      waitingToClearBuffer: false,
      clearBufferSafeMargin: 0,
      waitingToFlushBuffer: false,
      clearingBuffer: false,
      // The playhead might be seeking on startup, if a start time is set, so
      // start "seeked" as true.
      seeked: true,
      adaptation: false,
      recovering: false,
      hasError: false,
      operation: null,
      dependencyMediaState: null,
    };
    if (stream.dependencyStream) {
      mediaState.dependencyMediaState =
          this.createMediaState_(stream.dependencyStream);
    }
    return mediaState;
  }
Creates a media state.

@param {shaka.extern.Stream} stream
@return {shaka.media.StreamingEngine.MediaState_}
@private