code: @Override
    public MediaFormat detectMediaFormat(@Nullable String extension, long fileSize, long width, long height) {
      SortedSet<MediaFormat> matchingFormats = detectMediaFormats(extension, fileSize, width, height);
      return !matchingFormats.isEmpty() ? matchingFormats.first() : null;
    }
docs: Detect matching media format.
  @param extension File extension
  @param fileSize File size
  @param width Image width (or 0 if not image)
  @param height Image height (or 0 if not image)
  @return Media format or null if no matching media format found