Enum Class MediaFormat

java.lang.Object
java.lang.Enum<MediaFormat>
org.schabi.newpipe.extractor.MediaFormat
All Implemented Interfaces:
Serializable, Comparable<MediaFormat>, Constable

public enum MediaFormat extends Enum<MediaFormat>
Static data about various media formats support by NewPipe, eg mime type, extension
  • Enum Constant Details

  • Field Details

    • id

      public final int id
    • name

      @Nonnull public final String name
    • suffix

      @Nonnull public final String suffix
    • mimeType

      @Nonnull public final String mimeType
  • Method Details

    • values

      public static MediaFormat[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MediaFormat valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getNameById

      @Nonnull public static String getNameById(int id)
      Return the friendly name of the media format with the supplied id
      Parameters:
      id - the id of the media format. Currently an arbitrary, NewPipe-specific number.
      Returns:
      the friendly name of the MediaFormat associated with this ids, or an empty String if none match it.
    • getSuffixById

      @Nonnull public static String getSuffixById(int id)
      Return the file extension of the media format with the supplied id
      Parameters:
      id - the id of the media format. Currently an arbitrary, NewPipe-specific number.
      Returns:
      the file extension of the MediaFormat associated with this ids, or an empty String if none match it.
    • getMimeById

      @Nullable public static String getMimeById(int id)
      Return the MIME type of the media format with the supplied id
      Parameters:
      id - the id of the media format. Currently an arbitrary, NewPipe-specific number.
      Returns:
      the MIME type of the MediaFormat associated with this ids, or an empty String if none match it.
    • getFromMimeType

      @Nullable public static MediaFormat getFromMimeType(String mimeType)
      Return the first MediaFormat with the supplied mime type. There might be more formats which have the same mime type. To retrieve those, use getAllFromMimeType(String).
      Returns:
      MediaFormat associated with this mime type, or null if none match it.
    • getAllFromMimeType

      @Nonnull public static List<MediaFormat> getAllFromMimeType(String mimeType)
      Get all media formats which have the given mime type.
      Parameters:
      mimeType - the mime type to search for
      Returns:
      a modifiable List which contains the MediaFormats that have the given mime type.
    • getFormatById

      @Nullable public static MediaFormat getFormatById(int id)
      Get the media format by its id.
      Parameters:
      id - the id
      Returns:
      the id of the media format or null.
    • getFromSuffix

      @Nullable public static MediaFormat getFromSuffix(String suffix)
      Get the first media format that has the given suffix/file extension.
      Returns:
      the matching MediaFormat or null if no associated format is found
    • getName

      @Nonnull public String getName()
      Get the name of the format
      Returns:
      the name of the format
    • getSuffix

      @Nonnull public String getSuffix()
      Get the filename extension
      Returns:
      the filename extension
    • getMimeType

      @Nonnull public String getMimeType()
      Get the mime type
      Returns:
      the mime type