> Documentation index: https://developer.android.com/reference/llms.txt

# InAppFragmentedMp4Muxer

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

*** ** * ** ***


```
@UnstableApi
class InAppFragmentedMp4Muxer : Muxer
```

<br />

*** ** * ** ***

`Muxer` implementation that uses a `FragmentedMp4Muxer`.

## Summary

| ### Nested types |
|---|
| `class InAppFragmentedMp4Muxer.Factory : Muxer.Factory` `Muxer.Factory` for `InAppFragmentedMp4Muxer`. |

| ### Constants |
|---|---|
| `const String!` | `MUXER_NAME = "androidx.media3:media3-muxer:1.12.0-beta01"` |

| ### Public functions |
|---|---|
| `Unit` | `addMetadataEntry(metadataEntry: Metadata.Entry!)` Adds `metadata` about the output file. |
| `Int` | `addTrack(format: Format!)` Adds a track of the given media format. |
| `Unit` | `close()` Closes the file. |
| `Unit` | `writeSampleData( trackId: Int, byteBuffer: ByteBuffer!, bufferInfo: BufferInfo! )` Writes encoded sample data. |

### Inherited functions

From [java.lang.AutoCloseable](https://developer.android.com/reference/java/lang/AutoCloseable.md.txt) `abstract Unit` `close()`

## Constants

### MUXER_NAME

```
const val MUXER_NAME = "androidx.media3:media3-muxer:1.12.0-beta01": String!
```

## Public functions

### addMetadataEntry

```
fun addMetadataEntry(metadataEntry: Metadata.Entry!): Unit
```

Adds `metadata` about the output file.

| Parameters |
|---|---|
| `metadataEntry: Metadata.Entry!` | The `Metadata.Entry` to add. |

| Throws |
|---|---|
| `java.lang.IllegalStateException` | If the muxer is closed. |

### addTrack

```
fun addTrack(format: Format!): Int
```

Adds a track of the given media format.

All tracks must be added before any samples are written to any track.

| Parameters |
|---|---|
| `format: Format!` | The `Format` of the track. |

| Returns |
|---|---|
| `Int` | A track id for this track, which should be passed to `writeSampleData`. |

| Throws |
|---|---|
| `androidx.media3.muxer.MuxerException` | If the muxer encounters a problem while adding the track. |
| `java.lang.IllegalStateException` | If the muxer is closed. |

### close

```
fun close(): Unit
```

Closes the file.

The muxer cannot be used anymore once this method is called, even if it throws. Implementations must make further calls to this method a no-op and, once it has been called, must throw an `IllegalStateException` from all other methods.

| Throws |
|---|---|
| `androidx.media3.muxer.MuxerException` | If the muxer fails to finish writing the output. |

### writeSampleData

```
fun writeSampleData(
    trackId: Int,
    byteBuffer: ByteBuffer!,
    bufferInfo: BufferInfo!
): Unit
```

Writes encoded sample data.

| Parameters |
|---|---|
| `trackId: Int` | The track id, previously returned by `addTrack`. |
| `byteBuffer: ByteBuffer!` | A buffer containing the sample data to write to the container. |
| `bufferInfo: BufferInfo!` | The `BufferInfo` of the sample. |

| Throws |
|---|---|
| `androidx.media3.muxer.MuxerException` | If the muxer fails to write the sample. |
| `java.lang.IllegalStateException` | If the muxer is closed. |