# MediaPlayer.MetricsConstants

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

# MetricsConstants

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/media/MediaPlayer.MetricsConstants "View this page in Java")  

```
class MetricsConstants
```

|---|------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                           ||
| ↳ | [android.media.MediaPlayer.MetricsConstants](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#) |

## Summary

|                                                                                                                                                                                                               Constants                                                                                                                                                                                                                ||
|----------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [CODEC_AUDIO](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#CODEC_AUDIO:kotlin.String) Key to extract the codec being used to decode the audio track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.          |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [CODEC_VIDEO](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#CODEC_VIDEO:kotlin.String) Key to extract the codec being used to decode the video track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.          |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [DURATION](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#DURATION:kotlin.String) Key to extract the duration (in milliseconds) of the media being played from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.      |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [ERRORS](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#ERRORS:kotlin.String) Key to extract the count of errors encountered while playing the media from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.           |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [ERROR_CODE](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#ERROR_CODE:kotlin.String) Key to extract an (optional) error code detected while playing the media from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [FRAMES](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#FRAMES:kotlin.String) Key to extract the count of video frames played from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.                                  |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [FRAMES_DROPPED](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#FRAMES_DROPPED:kotlin.String) Key to extract the count of video frames dropped from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.                 |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [HEIGHT](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#HEIGHT:kotlin.String) Key to extract the height (in pixels) of the video track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.                         |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [MIME_TYPE_AUDIO](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#MIME_TYPE_AUDIO:kotlin.String) Key to extract the MIME type of the audio track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.                |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [MIME_TYPE_VIDEO](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#MIME_TYPE_VIDEO:kotlin.String) Key to extract the MIME type of the video track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.                |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [PLAYING](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#PLAYING:kotlin.String) Key to extract the playing time (in milliseconds) of the media being played from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.    |
| static[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [WIDTH](https://developer.android.com/reference/kotlin/android/media/MediaPlayer.MetricsConstants#WIDTH:kotlin.String) Key to extract the width (in pixels) of the video track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value.                            |

## Constants

### CODEC_AUDIO

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

```
static val CODEC_AUDIO: String
```

Key to extract the codec being used to decode the audio track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is a String.  

    Value: "android.media.mediaplayer.audio.codec"

### CODEC_VIDEO

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

```
static val CODEC_VIDEO: String
```

Key to extract the codec being used to decode the video track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is a String.  

    Value: "android.media.mediaplayer.video.codec"

### DURATION

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

```
static val DURATION: String
```

Key to extract the duration (in milliseconds) of the media being played from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is a long.  

    Value: "android.media.mediaplayer.durationMs"

### ERRORS

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

```
static val ERRORS: String
```

Key to extract the count of errors encountered while playing the media from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is an integer.  

    Value: "android.media.mediaplayer.err"

### ERROR_CODE

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

```
static val ERROR_CODE: String
```

Key to extract an (optional) error code detected while playing the media from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is an integer.  

    Value: "android.media.mediaplayer.errcode"

### FRAMES

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

```
static val FRAMES: String
```

Key to extract the count of video frames played from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is an integer.  

    Value: "android.media.mediaplayer.frames"

### FRAMES_DROPPED

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

```
static val FRAMES_DROPPED: String
```

Key to extract the count of video frames dropped from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is an integer.  

    Value: "android.media.mediaplayer.dropped"

### HEIGHT

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

```
static val HEIGHT: String
```

Key to extract the height (in pixels) of the video track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is an integer.  

    Value: "android.media.mediaplayer.height"

### MIME_TYPE_AUDIO

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

```
static val MIME_TYPE_AUDIO: String
```

Key to extract the MIME type of the audio track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is a String.  

    Value: "android.media.mediaplayer.audio.mime"

### MIME_TYPE_VIDEO

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

```
static val MIME_TYPE_VIDEO: String
```

Key to extract the MIME type of the video track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is a String.  

    Value: "android.media.mediaplayer.video.mime"

### PLAYING

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

```
static val PLAYING: String
```

Key to extract the playing time (in milliseconds) of the media being played from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is a long.  

    Value: "android.media.mediaplayer.playingMs"

### WIDTH

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

```
static val WIDTH: String
```

Key to extract the width (in pixels) of the video track from the[MediaPlayer.getMetrics](https://developer.android.com/reference/kotlin/android/media/MediaPlayer#getMetrics())return value. The value is an integer.  

    Value: "android.media.mediaplayer.width"