# FileTypes

# FileTypes

Artifact:[androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3)  
[View Source](https://cs.android.com/search?q=file:androidx/media3/common/FileTypes.java+class:androidx.media3.common.FileTypes)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/common/FileTypes "View this page in Java")

<br />

```
@UnstableApi
class FileTypes
```

<br />

*** ** * ** ***

Defines common file type constants and helper methods.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                ### Nested types                                                                                                                                                                                                                                                                                                                                                                                |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `@`[Documented](https://developer.android.com/reference/java/lang/annotation/Documented.html) `@`[Retention](https://developer.android.com/reference/java/lang/annotation/Retention.html)`(value = `[RetentionPolicy.SOURCE](https://developer.android.com/reference/java/lang/annotation/RetentionPolicy.html#SOURCE)`)` `@`[Target](https://developer.android.com/reference/java/lang/annotation/Target.html)`(value = `[ElementType.TYPE_USE](https://developer.android.com/reference/java/lang/annotation/ElementType.html#TYPE_USE)`)` `@`[IntDef](https://developer.android.com/reference/kotlin/androidx/annotation/IntDef)`(value = )` `annotation `[FileTypes.Type](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes.Type) File types. |

|                                    ### Constants                                    |
|-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [AC3](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#AC3())` = 0` File type for the AC-3 and E-AC-3 formats.             |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [AC4](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#AC4())` = 1` File type for the AC-4 format.                         |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [ADTS](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#ADTS())` = 2` File type for the ADTS format.                       |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [AMR](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#AMR())` = 3` File type for the AMR format.                          |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [AVI](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#AVI())` = 16` File type for the AVI format.                         |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [AVIF](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#AVIF())` = 21` File type for the AVIF format.                      |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [BMP](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#BMP())` = 19` File type for the BMP format.                         |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [FLAC](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#FLAC())` = 4` File type for the FLAC format.                       |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [FLV](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#FLV())` = 5` File type for the FLV format.                          |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [HEIF](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#HEIF())` = 20` File type for the HEIF format.                      |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [JPEG](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#JPEG())` = 14` File type for the JPEG format.                      |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [MATROSKA](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#MATROSKA())` = 6` File type for the Matroska and WebM formats. |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [MIDI](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#MIDI())` = 15` File type for the MIDI format.                      |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [MP3](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#MP3())` = 7` File type for the MP3 format.                          |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [MP4](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#MP4())` = 8` File type for the MP4 format.                          |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [OGG](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#OGG())` = 9` File type for the Ogg format.                          |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [PNG](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#PNG())` = 17` File type for the PNG format.                         |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [PS](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#PS())` = 10` File type for the MPEG-PS format.                       |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [TS](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#TS())` = 11` File type for the MPEG-TS format.                       |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [UNKNOWN](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#UNKNOWN())` = -1` Unknown file type.                            |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [WAV](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#WAV())` = 12` File type for the WAV format.                         |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [WEBP](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#WEBP())` = 18` File type for the WEBP format.                      |
| `const `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | [WEBVTT](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#WEBVTT())` = 13` File type for the WebVTT format.                |

|                                   ### Public functions                                    |
|-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | `@`[FileTypes.Type](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes.Type) [inferFileTypeFromMimeType](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#inferFileTypeFromMimeType(java.lang.String))`(mimeType: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?)` Returns the[Type](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes.Type)corresponding to the MIME type provided.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `java-static `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | `@`[FileTypes.Type](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes.Type) [inferFileTypeFromResponseHeaders](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#inferFileTypeFromResponseHeaders(java.util.Map<java.lang.String,java.util.List<java.lang.String>>))`(` ` responseHeaders: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-map/index.html)`)`[Map](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!, (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!>!>!` `)` Returns the[Type](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes.Type)corresponding to the response headers provided. |
| `java-static `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | `@`[FileTypes.Type](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes.Type) [inferFileTypeFromUri](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#inferFileTypeFromUri(android.net.Uri))`(uri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)`!)` Returns the[Type](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes.Type)corresponding to the[Uri](https://developer.android.com/reference/android/net/Uri.html)provided.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

## Constants

### AC3

```
const val AC3 = 0: Int
```

File type for the AC-3 and E-AC-3 formats.  

### AC4

```
const val AC4 = 1: Int
```

File type for the AC-4 format.  

### ADTS

```
const val ADTS = 2: Int
```

File type for the ADTS format.  

### AMR

```
const val AMR = 3: Int
```

File type for the AMR format.  

### AVI

```
const val AVI = 16: Int
```

File type for the AVI format.  

### AVIF

```
const val AVIF = 21: Int
```

File type for the AVIF format.  

### BMP

```
const val BMP = 19: Int
```

File type for the BMP format.  

### FLAC

```
const val FLAC = 4: Int
```

File type for the FLAC format.  

### FLV

```
const val FLV = 5: Int
```

File type for the FLV format.  

### HEIF

```
const val HEIF = 20: Int
```

File type for the HEIF format.  

### JPEG

```
const val JPEG = 14: Int
```

File type for the JPEG format.  

### MATROSKA

```
const val MATROSKA = 6: Int
```

File type for the Matroska and WebM formats.  

### MIDI

```
const val MIDI = 15: Int
```

File type for the MIDI format.  

### MP3

```
const val MP3 = 7: Int
```

File type for the MP3 format.  

### MP4

```
const val MP4 = 8: Int
```

File type for the MP4 format.  

### OGG

```
const val OGG = 9: Int
```

File type for the Ogg format.  

### PNG

```
const val PNG = 17: Int
```

File type for the PNG format.  

### PS

```
const val PS = 10: Int
```

File type for the MPEG-PS format.  

### TS

```
const val TS = 11: Int
```

File type for the MPEG-TS format.  

### UNKNOWN

```
const val UNKNOWN = -1: Int
```

Unknown file type.  

### WAV

```
const val WAV = 12: Int
```

File type for the WAV format.  

### WEBP

```
const val WEBP = 18: Int
```

File type for the WEBP format.  

### WEBVTT

```
const val WEBVTT = 13: Int
```

File type for the WebVTT format.  

## Public functions

### inferFileTypeFromMimeType

```
@FileTypes.Type
java-static fun inferFileTypeFromMimeType(mimeType: String?): Int
```

Returns the[Type](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes.Type)corresponding to the MIME type provided.

Returns[UNKNOWN](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes#UNKNOWN())if the MIME type is`null`.  

### inferFileTypeFromResponseHeaders

```
@FileTypes.Type
java-static fun inferFileTypeFromResponseHeaders(
    responseHeaders: (Mutable)Map<String!, (Mutable)List<String!>!>!
): Int
```

Returns the[Type](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes.Type)corresponding to the response headers provided.  

### inferFileTypeFromUri

```
@FileTypes.Type
java-static fun inferFileTypeFromUri(uri: Uri!): Int
```

Returns the[Type](https://developer.android.com/reference/kotlin/androidx/media3/common/FileTypes.Type)corresponding to the[Uri](https://developer.android.com/reference/android/net/Uri.html)provided.