@UnstableApi
class InAppMuxer : Muxer


Muxer implementation that uses a Mp4Muxer.

Summary

Nested types

Muxer.Factory for InAppMuxer.

A builder for Factory instances.

Provides metadata to add in the output MP4 file.

Public functions

Unit
addMetadata(metadata: Metadata!)

Adds Metadata about the output file.

Int
addTrack(format: Format!)

Adds a track with the specified format.

Unit
release(forCancellation: Boolean)

Finishes writing the output and releases any resources associated with muxing.

Unit
writeSampleData(
    trackIndex: Int,
    data: ByteBuffer!,
    presentationTimeUs: Long,
    @C.BufferFlags flags: Int
)

Writes the specified sample.

Public properties

Long

Public functions

addMetadata

fun addMetadata(metadata: Metadata!): Unit

Adds Metadata about the output file.

addTrack

fun addTrack(format: Format!): Int

Adds a track with the specified format.

Parameters
format: Format!

The Format of the track.

Returns
Int

The index for this track, which should be passed to writeSampleData.

Throws
androidx.media3.transformer.Muxer.MuxerException

If the muxer encounters a problem while adding the track.

release

fun release(forCancellation: Boolean): Unit

Finishes writing the output and releases any resources associated with muxing.

The muxer cannot be used anymore once this method has been called.

Parameters
forCancellation: Boolean

Whether the reason for releasing the resources is the export cancellation.

Throws
androidx.media3.transformer.Muxer.MuxerException

If the muxer fails to finish writing the output and forCancellation is false.

writeSampleData

fun writeSampleData(
    trackIndex: Int,
    data: ByteBuffer!,
    presentationTimeUs: Long,
    @C.BufferFlags flags: Int
): Unit

Writes the specified sample.

Parameters
trackIndex: Int

The index of the track, previously returned by addTrack.

data: ByteBuffer!

A buffer containing the sample data to write to the container.

presentationTimeUs: Long

The presentation time of the sample in microseconds.

@C.BufferFlags flags: Int

The C.BufferFlags associated with the data. Only BUFFER_FLAG_KEY_FRAME and BUFFER_FLAG_END_OF_STREAM are supported.

Throws
androidx.media3.transformer.Muxer.MuxerException

If the muxer fails to write the sample.

Public properties

maxDelayBetweenSamplesMs

val maxDelayBetweenSamplesMsLong