InAppFragmentedMp4Muxer.Factory


class InAppFragmentedMp4Muxer.Factory : Muxer.Factory


Muxer.Factory for InAppFragmentedMp4Muxer.

Summary

Public constructors

Creates an instance with default values.

Factory(fragmentDurationMs: Long)

Creates an instance.

Public functions

InAppFragmentedMp4Muxer!
create(path: String!)

Returns a new Muxer.

InAppFragmentedMp4Muxer!

Returns a new Muxer.

ImmutableList<String!>!

Returns the supported sample MIME types for the given C.TrackType.

InAppFragmentedMp4Muxer.Factory!

Sets the duration of the video track (in microseconds) in the output.

Inherited functions

From androidx.media3.muxer.Muxer.Factory
Boolean

Whether the muxer supports writing negative timestamps into an edit list to instruct players to ignore these samples.

Public constructors

Factory

Factory()

Creates an instance with default values.

Factory

Factory(fragmentDurationMs: Long)

Creates an instance.

Parameters
fragmentDurationMs: Long

The fragment duration (in milliseconds).

Public functions

create

fun create(path: String!): InAppFragmentedMp4Muxer!

Returns a new Muxer.

Parameters
path: String!

The path to the output file.

Throws
androidx.media3.muxer.MuxerException

If an error occurs opening the output file for writing.

create

fun create(pfd: ParcelFileDescriptor!): InAppFragmentedMp4Muxer!

Returns a new Muxer.

The caller transfers ownership of the ParcelFileDescriptor to the Factory. If this method returns successfully, the created Muxer is responsible for closing the descriptor when close is called. If an error occurs and a MuxerException is thrown, the descriptor is closed before the exception is thrown.

Whether the provided ParcelFileDescriptor must be seekable depends on the container format and Muxer implementation. For example, standard MP4 muxers require seekable descriptors (such as those opened with "rwt" or "rw"), whereas streaming muxers (such as fragmented MP4 muxers) also accept non-seekable streams like pipes.

Parameters
pfd: ParcelFileDescriptor!

the ParcelFileDescriptor to write output to

Throws
androidx.media3.muxer.MuxerException

if an error occurs opening the output for writing or if the descriptor does not satisfy the seekability requirements of the muxer

getSupportedSampleMimeTypes

fun getSupportedSampleMimeTypes(@C.TrackType trackType: Int): ImmutableList<String!>!

Returns the supported sample MIME types for the given C.TrackType.

setVideoDurationUs

@CanIgnoreReturnValue
fun setVideoDurationUs(videoDurationUs: Long): InAppFragmentedMp4Muxer.Factory!

Sets the duration of the video track (in microseconds) in the output.

Only the duration of the last sample is adjusted to achieve the given duration. Duration of the other samples remains unchanged.

The default is TIME_UNSET to not set any duration in the output. In this case the video track duration is determined by the samples written to it and the duration of the last sample will be same as that of the sample before that.

Parameters
videoDurationUs: Long

The duration of the video track (in microseconds) in the output, or TIME_UNSET to not set any duration. Only applicable when a video track is added.

Returns
InAppFragmentedMp4Muxer.Factory!

This factory.