Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#nestedclasses) \| [Inherited Constants](https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#inhconstants) \| [Fields](https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#lfields) \| [Methods](https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#inhmethods)

# ApplicationMediaCapabilities

*** ** * ** ***


`
public

final

class
ApplicationMediaCapabilities
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.media.ApplicationMediaCapabilities |

<br />

*** ** * ** ***

ApplicationMediaCapabilities is an immutable class that encapsulates an application's capabilities
for handling newer video codec format and media features.


Android 12 introduces Compatible media transcoding feature. See
[Compatible media transcoding](https://developer.android.com/about/versions/12/features#compatible_media_transcoding). By default, Android assumes apps can support playback of all
media formats. Apps that would like to request that media be transcoded into a more compatible
format should declare their media capabilities in a media_capabilities.xml resource file and add it
as a property tag in the AndroidManifest.xml file. Here is a example:

    <media-capabilities xmlns:android="http://schemas.android.com/apk/res/android">
        <format android:name="HEVC" supported="true"/>
        <format android:name="HDR10" supported="false"/>
        <format android:name="HDR10Plus" supported="false"/>
    </media-capabilities>

The ApplicationMediaCapabilities class is generated from this xml and used by the platform to represent an application's media capabilities in order to determine whether modern media files need to be transcoded for that application.

<br />


ApplicationMediaCapabilities objects can also be built by applications at runtime for use with
`https://developer.android.com/reference/android/content/ContentResolver#openTypedAssetFileDescriptor(android.net.Uri,%20java.lang.String,%20android.os.Bundle)` to provide more
control over the transcoding that is built into the platform. ApplicationMediaCapabilities
provided by applications at runtime like this override the default manifest capabilities for that
media access.The object could be build either through `https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#createFromXml(org.xmlpull.v1.XmlPullParser)` or
through the builder class `https://developer.android.com/reference/android/media/ApplicationMediaCapabilities.Builder`

### Video Codec Support


Newer video codes include HEVC, VP9 and AV1. Application only needs to indicate their support
for newer format with this class as they are assumed to support older format like h.264.

### Capability of handling HDR(high dynamic range) video


There are four types of HDR video(Dolby-Vision, HDR10, HDR10+, HLG) supported by the platform,
application will only need to specify individual types they supported.

## Summary

| ### Nested classes ||
|---|---|
| ` class` | `https://developer.android.com/reference/android/media/ApplicationMediaCapabilities.Builder` Builder class for `https://developer.android.com/reference/android/media/ApplicationMediaCapabilities` objects. |

| ### Inherited constants |
|---|
| From interface `https://developer.android.com/reference/android/os/Parcelable` |---|---| | `int` | `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor. | | `int` | `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/media/ApplicationMediaCapabilities>` | `https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#CREATOR` |

| ### Public methods ||
|---|---|
| ` static https://developer.android.com/reference/android/media/ApplicationMediaCapabilities` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#createFromXml(org.xmlpull.v1.XmlPullParser)(https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser xmlParser) ` Creates `https://developer.android.com/reference/android/media/ApplicationMediaCapabilities` from an xml. |
| ` int` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#getSupportedHdrTypes()() ` Query all hdr types that are supported by the application. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#getSupportedVideoMimeTypes()() ` Query the video codec mime types supported by the application. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#getUnsupportedHdrTypes()() ` Query all hdr types that are not supported by the application. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#getUnsupportedVideoMimeTypes()() ` Query the video codec mime types that are not supported by the application. |
| ` boolean` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#isFormatSpecified(java.lang.String)(https://developer.android.com/reference/java/lang/String format) ` Query if a format is specified by the application. |
| ` boolean` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#isHdrTypeSupported(java.lang.String)(https://developer.android.com/reference/java/lang/String hdrType) ` Query if a HDR type is supported by the application. |
| ` boolean` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#isVideoMimeTypeSupported(java.lang.String)(https://developer.android.com/reference/java/lang/String videoMime) ` Query if a video codec format is supported by the application. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. |

| ### Inherited methods |
|---|---|
| From class ` https://developer.android.com/reference/java/lang/Object ` |---|---| | ` https://developer.android.com/reference/java/lang/Object` | ` https://developer.android.com/reference/java/lang/Object#clone()() ` Creates and returns a copy of this object. | | ` boolean` | ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Indicates whether some other object is "equal to" this one. | | ` void` | ` https://developer.android.com/reference/java/lang/Object#finalize()() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object. | | ` final https://developer.android.com/reference/java/lang/Class<?>` | ` https://developer.android.com/reference/java/lang/Object#getClass()() ` Returns the runtime class of this `Object`. | | ` int` | ` https://developer.android.com/reference/java/lang/Object#hashCode()() ` Returns a hash code value for the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notify()() ` Wakes up a single thread that is waiting on this object's monitor. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#notifyAll()() ` Wakes up all threads that are waiting on this object's monitor. | | ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/Object#toString()() ` Returns a string representation of the object. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed. | | ` final void` | ` https://developer.android.com/reference/java/lang/Object#wait()() ` Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*. | ||
| From interface ` https://developer.android.com/reference/android/os/Parcelable ` |---|---| | ` abstract int` | ` https://developer.android.com/reference/android/os/Parcelable#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. | | ` abstract void` | ` https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. | ||

## Fields

### CREATOR

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<ApplicationMediaCapabilities> CREATOR
```

<br />

<br />

## Public methods

### createFromXml

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ApplicationMediaCapabilities createFromXml (XmlPullParser xmlParser)
```

Creates `https://developer.android.com/reference/android/media/ApplicationMediaCapabilities` from an xml.

The xml's syntax is the same as the media_capabilities.xml used by the AndroidManifest.xml.

Here is an example:

    <media-capabilities xmlns:android="http://schemas.android.com/apk/res/android">
        <format android:name="HEVC" supported="true"/>
        <format android:name="HDR10" supported="false"/>
        <format android:name="HDR10Plus" supported="false"/>
    </media-capabilities>

<br />

<br />

| Parameters ||
|---|---|
| `xmlParser` | `XmlPullParser`: The underlying `https://developer.android.com/reference/org/xmlpull/v1/XmlPullParser` that will read the xml. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/ApplicationMediaCapabilities` | An ApplicationMediaCapabilities object. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if the capabilities in xml config are invalid or incompatible. |

### describeContents

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int describeContents ()
```

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`,
the return value of this method must include the
`https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### getSupportedHdrTypes

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<String> getSupportedHdrTypes ()
```

Query all hdr types that are supported by the application.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | List of supported hdr types. The list will be empty if there are none. This value cannot be `null`. <br /> |

### getSupportedVideoMimeTypes

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<String> getSupportedVideoMimeTypes ()
```

Query the video codec mime types supported by the application.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | List of supported video codec mime types. The list will be empty if there are none. This value cannot be `null`. <br /> |

### getUnsupportedHdrTypes

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<String> getUnsupportedHdrTypes ()
```

Query all hdr types that are not supported by the application.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | List of unsupported hdr types. The list will be empty if there are none. This value cannot be `null`. <br /> |

### getUnsupportedVideoMimeTypes

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<String> getUnsupportedVideoMimeTypes ()
```

Query the video codec mime types that are not supported by the application.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | List of unsupported video codec mime types. The list will be empty if there are none. This value cannot be `null`. <br /> |

### isFormatSpecified

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isFormatSpecified (String format)
```

Query if a format is specified by the application.


The format could be either the video format or the hdr format.

<br />

| Parameters ||
|---|---|
| `format` | `String`: The name of the format. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | true if application specifies the format, false otherwise. <br /> |

### isHdrTypeSupported

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isHdrTypeSupported (String hdrType)
```

Query if a HDR type is supported by the application.


If the application has not specified supporting the format or not, this will return false.
Use `https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#isFormatSpecified(java.lang.String)` to query if a format is specified or not.

<br />

| Parameters ||
|---|---|
| `hdrType` | `String`: The type of the HDR format. This value cannot be `null`. Value is one of the following: - `https://developer.android.com/reference/android/media/MediaFeature.HdrType#DOLBY_VISION` - `https://developer.android.com/reference/android/media/MediaFeature.HdrType#HDR10` - `https://developer.android.com/reference/android/media/MediaFeature.HdrType#HDR10_PLUS` - `https://developer.android.com/reference/android/media/MediaFeature.HdrType#HLG` |

| Returns ||
|---|---|
| `boolean` | true if application supports the HDR format, false otherwise. <br /> |

### isVideoMimeTypeSupported

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isVideoMimeTypeSupported (String videoMime)
```

Query if a video codec format is supported by the application.


If the application has not specified supporting the format or not, this will return false.
Use `https://developer.android.com/reference/android/media/ApplicationMediaCapabilities#isFormatSpecified(java.lang.String)` to query if a format is specified or not.

<br />

| Parameters ||
|---|---|
| `videoMime` | `String`: The mime type of the video codec format. Must be the one used in `https://developer.android.com/reference/android/media/MediaFormat#KEY_MIME`. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | true if application supports the video codec format, false otherwise. <br /> |

### toString

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### writeToParcel

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |