Class EditedMediaItem.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.transformer.EditedMediaItem.Builder
-
- Enclosing class:
- EditedMediaItem
public static final class EditedMediaItem.Builder extends Object
A builder forEditedMediaIteminstances.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EditedMediaItembuild()Builds anEditedMediaIteminstance.EditedMediaItem.BuildersetDurationUs(long durationUs)Sets the duration of the output video in microseconds.EditedMediaItem.BuildersetEffects(Effects effects)EditedMediaItem.BuildersetFlattenForSlowMotion(boolean flattenForSlowMotion)Sets whether to flatten theMediaItemif it contains slow motion markers.EditedMediaItem.BuildersetFrameRate(int frameRate)Sets the frame rate of the output video in frames per second.EditedMediaItem.BuildersetRemoveAudio(boolean removeAudio)Sets whether to remove the audio from theMediaItem.EditedMediaItem.BuildersetRemoveVideo(boolean removeVideo)Sets whether to remove the video from theMediaItem.
-
-
-
Constructor Detail
-
Builder
public Builder(MediaItem mediaItem)
Creates an instance.For image inputs, the values passed into
setRemoveAudio(boolean),setRemoveVideo(boolean)andsetFlattenForSlowMotion(boolean)will be ignored.- Parameters:
mediaItem- TheMediaItemon which transformations are applied.
-
-
Method Detail
-
setRemoveAudio
@CanIgnoreReturnValue public EditedMediaItem.Builder setRemoveAudio(boolean removeAudio)
Sets whether to remove the audio from theMediaItem.The default value is
false.The audio and video cannot both be removed because the output would not contain any samples.
- Parameters:
removeAudio- Whether to remove the audio.- Returns:
- This builder.
-
setRemoveVideo
@CanIgnoreReturnValue public EditedMediaItem.Builder setRemoveVideo(boolean removeVideo)
Sets whether to remove the video from theMediaItem.The default value is
false.The audio and video cannot both be removed because the output would not contain any samples.
- Parameters:
removeVideo- Whether to remove the video.- Returns:
- This builder.
-
setFlattenForSlowMotion
@CanIgnoreReturnValue public EditedMediaItem.Builder setFlattenForSlowMotion(boolean flattenForSlowMotion)
Sets whether to flatten theMediaItemif it contains slow motion markers.The default value is
false.See
flattenForSlowMotionfor more information about slow motion flattening.If using an
ExoPlayerAssetLoader.Factorywith a providedMediaSource.Factory, make sure thatMp4Extractor.FLAG_READ_SEF_DATAis set on theMp4Extractorused. Otherwise, the slow motion metadata will be ignored and the input won't be flattened.Slow motion flattening is only supported when the
Compositioncontains exactly oneMediaItem.Using slow motion flattening together with
MediaItem.ClippingConfigurationis not supported yet.- Parameters:
flattenForSlowMotion- Whether to flatten for slow motion.- Returns:
- This builder.
-
setDurationUs
@CanIgnoreReturnValue public EditedMediaItem.Builder setDurationUs(long durationUs)
Sets the duration of the output video in microseconds.This should be set for inputs that don't have an implicit duration (e.g. images). It will be ignored for inputs that do have an implicit duration (e.g. video).
No duration is set by default.
-
setFrameRate
@CanIgnoreReturnValue public EditedMediaItem.Builder setFrameRate(@IntRange(from=0L) int frameRate)
Sets the frame rate of the output video in frames per second.This should be set for inputs that don't have an implicit frame rate (e.g. images). It will be ignored for inputs that do have an implicit frame rate (e.g. video).
No frame rate is set by default.
-
setEffects
@CanIgnoreReturnValue public EditedMediaItem.Builder setEffects(Effects effects)
- Parameters:
effects- TheEffectsto apply.- Returns:
- This builder.
-
build
public EditedMediaItem build()
Builds anEditedMediaIteminstance.
-
-