@UnstableApi
class InAppMp4Muxer : Muxer


Muxer implementation that uses an Mp4Muxer.

Summary

Nested types

Muxer.Factory for InAppMp4Muxer.

Provides metadata to add in the output MP4 file.

Constants

const String!
MUXER_NAME = "androidx.media3.media3-muxer:1.6.0-alpha03"

Public functions

Unit

Adds metadata about the output file.

Int
addTrack(format: Format!)

Adds a track of the given media format.

Unit

Closes the file.

Unit
writeSampleData(
    trackId: Int,
    byteBuffer: ByteBuffer!,
    bufferInfo: MediaCodec.BufferInfo!
)

Writes encoded sample data.

Constants

MUXER_NAME

const val MUXER_NAME = "androidx.media3.media3-muxer:1.6.0-alpha03": String!

Public functions

addMetadataEntry

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

Adds metadata about the output file.

addTrack

fun addTrack(format: Format!): Int

Adds a track of the given media format.

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.

close

fun close(): Unit

Closes the file.

The muxer cannot be used anymore once this method returns.

Throws
androidx.media3.muxer.MuxerException

If the muxer fails to finish writing the output.

writeSampleData

fun writeSampleData(
    trackId: Int,
    byteBuffer: ByteBuffer!,
    bufferInfo: MediaCodec.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: MediaCodec.BufferInfo!

The BufferInfo of the sample.

Throws
androidx.media3.muxer.MuxerException

If the muxer fails to write the sample.