public final class

FragmentedMp4Muxer.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media3.muxer.FragmentedMp4Muxer.Builder

Overview

A builder for FragmentedMp4Muxer instances.

Summary

Constructors
publicBuilder(java.io.FileOutputStream fileOutputStream)

Creates a FragmentedMp4Muxer.Builder instance with default values.

Methods
public FragmentedMp4Muxerbuild()

Builds a FragmentedMp4Muxer instance.

public FragmentedMp4Muxer.BuildersetFragmentDurationMs(long fragmentDurationMs)

Sets the fragment duration (in milliseconds).

public FragmentedMp4Muxer.BuildersetSampleCopyEnabled(boolean enabled)

Sets whether to enable the sample copy.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder(java.io.FileOutputStream fileOutputStream)

Creates a FragmentedMp4Muxer.Builder instance with default values.

Parameters:

fileOutputStream: The java.io.FileOutputStream to write the media data to.

Methods

public FragmentedMp4Muxer.Builder setFragmentDurationMs(long fragmentDurationMs)

Sets the fragment duration (in milliseconds).

The muxer will attempt to create fragments of the given duration but the actual duration might be greater depending upon the frequency of sync samples.

The default value is FragmentedMp4Muxer.DEFAULT_FRAGMENT_DURATION_MS.

public FragmentedMp4Muxer.Builder setSampleCopyEnabled(boolean enabled)

Sets whether to enable the sample copy.

If the sample copy is enabled, Muxer.writeSampleData(Muxer.TrackToken, ByteBuffer, BufferInfo) copies the input java.nio.ByteBuffer and before it returns, so it is safe to reuse them immediately. Otherwise, the muxer takes ownership of the java.nio.ByteBuffer and the and the caller must not modify them.

The default value is true.

public FragmentedMp4Muxer build()

Builds a FragmentedMp4Muxer instance.