EditedMediaItemSequence.Builder


public final class EditedMediaItemSequence.Builder


A builder for instances of EditedMediaItemSequence.

Summary

Public constructors

Builder(EditedMediaItem[] editedMediaItems)

Creates an instance.

Builder(List<EditedMediaItem> editedMediaItems)

Public constructors

Builder

public Builder(EditedMediaItem[] editedMediaItems)

Creates an instance.

Builder

public Builder(List<EditedMediaItem> editedMediaItems)

Public methods

addGap

@CanIgnoreReturnValue
public EditedMediaItemSequence.Builder addGap(long durationUs)

Adds a gap to the sequence.

A gap is a period of time with no media.

If the gap is added at the start of the sequence, then force audio track or/and force video track flag must be set appropriately.

Parameters
long durationUs

The duration of the gap, in milliseconds.

Returns
EditedMediaItemSequence.Builder

This builder, for convenience.

addItem

@CanIgnoreReturnValue
public EditedMediaItemSequence.Builder addItem(EditedMediaItem item)

Adds the item to the sequence.

Parameters
EditedMediaItem item

The EditedMediaItem to add.

Returns
EditedMediaItemSequence.Builder

This builder, for convenience.

addItems

@CanIgnoreReturnValue
public EditedMediaItemSequence.Builder addItems(EditedMediaItem[] items)

Adds the items to the sequence.

Parameters
EditedMediaItem[] items

The EditedMediaItem instances to add.

Returns
EditedMediaItemSequence.Builder

This builder, for convenience.

addItems

@CanIgnoreReturnValue
public EditedMediaItemSequence.Builder addItems(List<EditedMediaItem> items)

Adds all the items in the list to the sequence.

Parameters
List<EditedMediaItem> items

The list of EditedMediaItem instances to add.

Returns
EditedMediaItemSequence.Builder

This builder, for convenience.

build

public EditedMediaItemSequence build()

Builds the EditedMediaItemSequence.

There must be at least one item in the sequence.

experimentalSetForceAudioTrack

@CanIgnoreReturnValue
public EditedMediaItemSequence.Builder experimentalSetForceAudioTrack(boolean forceAudioTrack)

Forces silent audio in the sequence.

This flag is necessary when:

  • The first EditedMediaItem in the sequence does not contain audio, but subsequent items do.
  • The first item in the sequence is a gap and the subsequent media items contain audio.

If the flag is not set appropriately, then the export will fail.

If the first EditedMediaItem already contains audio, this flag has no effect.

The MIME type of the output's audio track can be set using setAudioMimeType. The sample rate and channel count can be set by passing relevant AudioProcessor instances to the Composition.

Forcing an audio track and requesting audio transmuxing are not allowed together because generating silence requires transcoding.

The default value is false.

This method is experimental and will be renamed or removed in a future release.

Parameters
boolean forceAudioTrack

Whether to force audio track.

experimentalSetForceVideoTrack

@CanIgnoreReturnValue
public EditedMediaItemSequence.Builder experimentalSetForceVideoTrack(boolean forceVideoTrack)

Forces blank frames in the sequence.

This flag is necessary when:

  • The first EditedMediaItem in the sequence does not contain video, but subsequent items do.
  • The first item in the sequence is a gap and the subsequent media items contain video.

If the flag is not set appropriately, then the export will fail.

If the first EditedMediaItem already contains video, this flag has no effect.

The MIME type of the output's video track can be set using setVideoMimeType.

The output resolution must be set using a Presentation effect on the .

Forcing a video track and requesting video transmuxing are not allowed together because generating blank frames requires transcoding.

The default value is false.

This method is experimental and will be renamed or removed in a future release.

Parameters
boolean forceVideoTrack

Whether to force video track.

setIsLooping

@CanIgnoreReturnValue
public EditedMediaItemSequence.Builder setIsLooping(boolean isLooping)

See isLooping.

Looping is false by default.

Parameters
boolean isLooping

Whether this sequence should loop.

Returns
EditedMediaItemSequence.Builder

This builder, for convenience.