InAppMp4Muxer.Factory
public final class InAppMp4Muxer.Factory implements Muxer.Factory
Muxer.Factory for InAppMp4Muxer.
Summary
Public constructors |
|---|
Factory()Creates an instance with default values. |
Factory(@Nullable InAppMp4Muxer.MetadataProvider metadataProvider)Creates an instance. |
Public methods |
|
|---|---|
InAppMp4Muxer |
Returns a new |
ImmutableList<String> |
getSupportedSampleMimeTypes(@C.TrackType int trackType)Returns the supported sample |
InAppMp4Muxer.Factory |
@CanIgnoreReturnValueSets whether to attempt to write a file where the metadata is stored at the start, which can make the file more efficient to read sequentially. |
InAppMp4Muxer.Factory |
@CanIgnoreReturnValueSets the amount of free space (in bytes) to be reserved after the File Type box in the MP4 file. |
InAppMp4Muxer.Factory |
@CanIgnoreReturnValueSets the duration of the video track (in microseconds) in the output. |
boolean |
Whether the muxer supports writing negative timestamps into an edit list to instruct players to ignore these samples. |
Public constructors
Factory
public Factory(@Nullable InAppMp4Muxer.MetadataProvider metadataProvider)
Creates an instance.
| Parameters | |
|---|---|
@Nullable InAppMp4Muxer.MetadataProvider metadataProvider |
Public methods
create
public InAppMp4Muxer create(String path)
Returns a new Muxer.
| Parameters | |
|---|---|
String path |
The path to the output file. |
| Throws | |
|---|---|
androidx.media3.muxer.MuxerException |
If an error occurs opening the output file for writing. |
getSupportedSampleMimeTypes
public ImmutableList<String> getSupportedSampleMimeTypes(@C.TrackType int trackType)
Returns the supported sample MIME types for the given C.TrackType.
setAttemptStreamableOutputEnabled
@CanIgnoreReturnValue
public InAppMp4Muxer.Factory setAttemptStreamableOutputEnabled(
boolean attemptStreamableOutputEnabled
)
Sets whether to attempt to write a file where the metadata is stored at the start, which can make the file more efficient to read sequentially.
Setting to true does not guarantee a streamable MP4 output.
Setting to true reserves space at the start of the file which leads to increased file size. Set this to false for smaller file size.
The default value is true.
| Parameters | |
|---|---|
boolean attemptStreamableOutputEnabled |
Whether to attempt to write a streamable file. |
| Returns | |
|---|---|
InAppMp4Muxer.Factory |
This factory. |
setFreeSpaceAfterFileTypeBoxBytes
@CanIgnoreReturnValue
public InAppMp4Muxer.Factory setFreeSpaceAfterFileTypeBoxBytes(int freeSpaceAfterFileTypeBoxBytes)
Sets the amount of free space (in bytes) to be reserved after the File Type box in the MP4 file. The amount of free space that gets reserved is handled by experimentalSetFreeSpaceAfterFileTypeBox.
| Parameters | |
|---|---|
int freeSpaceAfterFileTypeBoxBytes |
The free space after file type box in the output. |
| Returns | |
|---|---|
InAppMp4Muxer.Factory |
This factory. |
setVideoDurationUs
@CanIgnoreReturnValue
public InAppMp4Muxer.Factory setVideoDurationUs(long videoDurationUs)
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 | |
|---|---|
long videoDurationUs |
The duration of the video track (in microseconds) in the output, or |
| Returns | |
|---|---|
InAppMp4Muxer.Factory |
This factory. |
supportsWritingNegativeTimestampsInEditList
public boolean supportsWritingNegativeTimestampsInEditList()
Whether the muxer supports writing negative timestamps into an edit list to instruct players to ignore these samples.