async guessMimeType_(contentType, codecs, segments) {
    const HlsParser = shaka.hls.HlsParser;
    const requestType = shaka.net.NetworkingEngine.RequestType.SEGMENT;

    const {segment} = this.getAvailableSegment_(segments);

    if (segment.status == shaka.media.SegmentReference.Status.MISSING) {
      return this.guessMimeTypeFallback_(contentType);
    }

    const segmentUris = segment.getUris();

    const parsedUri = new goog.Uri(segmentUris[0]);
    const extension = parsedUri.getPath().split('.').pop();
    const map = HlsParser.EXTENSION_MAP_BY_CONTENT_TYPE_.get(contentType);

    let mimeType = map.get(extension);
    if (mimeType) {
      return mimeType;
    }

    mimeType = HlsParser.RAW_FORMATS_TO_MIME_TYPES_.get(extension);
    if (mimeType) {
      return mimeType;
    }

    // The extension map didn't work, so guess based on codecs.
    mimeType = this.guessMimeTypeBeforeLoading_(contentType, codecs);
    if (mimeType) {
      return mimeType;
    }

    // If unable to guess mime type, request a segment and try getting it
    // from the response.
    let contentMimeType;
    const type = shaka.net.NetworkingEngine.AdvancedRequestType.MEDIA_SEGMENT;
    const headRequest = shaka.net.NetworkingEngine.makeRequest(
        segmentUris, this.config_.retryParameters);
    let response;
    try {
      headRequest.method = 'HEAD';
      response = await this.makeNetworkRequest_(
          headRequest, requestType, {type}).promise;

      contentMimeType = response.headers['content-type'];
    } catch (error) {
      if (error &&
        (error.code == shaka.util.Error.Code.HTTP_ERROR ||
         error.code == shaka.util.Error.Code.BAD_HTTP_STATUS)) {
        headRequest.method = 'GET';
        if (this.config_.hls.allowRangeRequestsToGuessMimeType) {
          // Only requesting first byte
          headRequest.headers['Range'] = 'bytes=0-0';
        }
        response = await this.makeNetworkRequest_(
            headRequest, requestType, {type}).promise;

        contentMimeType = response.headers['content-type'];
      }
    }

    if (contentMimeType) {
      // Split the MIME type in case the server sent additional parameters.
      mimeType = contentMimeType.toLowerCase().split(';')[0];
      if (mimeType == 'application/octet-stream') {
        if (!response.data.byteLength) {
          headRequest.method = 'GET';
          response = await this.makeNetworkRequest_(
              headRequest, requestType, {type}).promise;
        }
        if (shaka.util.TsParser.probe(
            shaka.util.BufferUtils.toUint8(response.data))) {
          mimeType = 'video/mp2t';
        }
      }
      if (mimeType != 'application/octet-stream') {
        return mimeType;
      }
    }

    return this.guessMimeTypeFallback_(contentType);
  }
Attempts to guess stream's mime type.

@param {string} contentType
@param {string} codecs
@param {!Array<!shaka.media.SegmentReference>} segments
@return {!Promise<string>}
@private