Class MediaItem.Builder
- java.lang.Object
-
- com.google.android.exoplayer2.MediaItem.Builder
-
-
Constructor Summary
Constructors Constructor Description Builder()
Creates a builder.
-
Method Summary
-
-
-
Method Detail
-
setMediaId
@CanIgnoreReturnValue public MediaItem.Builder setMediaId(String mediaId)
Sets the optional media ID which identifies the media item.By default
MediaItem.DEFAULT_MEDIA_ID
is used.
-
setUri
@CanIgnoreReturnValue public MediaItem.Builder setUri(@Nullable String uri)
Sets the optional URI.If
uri
is null or unset then noMediaItem.LocalConfiguration
object is created duringbuild()
and no otherBuilder
methods that would populateMediaItem.localConfiguration
should be called.
-
setUri
@CanIgnoreReturnValue public MediaItem.Builder setUri(@Nullable Uri uri)
Sets the optional URI.If
uri
is null or unset then noMediaItem.LocalConfiguration
object is created duringbuild()
and no otherBuilder
methods that would populateMediaItem.localConfiguration
should be called.
-
setMimeType
@CanIgnoreReturnValue public MediaItem.Builder setMimeType(@Nullable String mimeType)
Sets the optional MIME type.The MIME type may be used as a hint for inferring the type of the media item.
This method should only be called if
setUri(java.lang.String)
is passed a non-null value.- Parameters:
mimeType
- The MIME type.
-
setClippingConfiguration
@CanIgnoreReturnValue public MediaItem.Builder setClippingConfiguration(MediaItem.ClippingConfiguration clippingConfiguration)
Sets theMediaItem.ClippingConfiguration
, defaults toMediaItem.ClippingConfiguration.UNSET
.
-
setClipStartPositionMs
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setClipStartPositionMs(@IntRange(from=0L) long startPositionMs)
Deprecated.
-
setClipEndPositionMs
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setClipEndPositionMs(long endPositionMs)
Deprecated.
-
setClipRelativeToLiveWindow
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setClipRelativeToLiveWindow(boolean relativeToLiveWindow)
Deprecated.
-
setClipRelativeToDefaultPosition
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setClipRelativeToDefaultPosition(boolean relativeToDefaultPosition)
-
setClipStartsAtKeyFrame
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setClipStartsAtKeyFrame(boolean startsAtKeyFrame)
Deprecated.
-
setDrmConfiguration
@CanIgnoreReturnValue public MediaItem.Builder setDrmConfiguration(@Nullable MediaItem.DrmConfiguration drmConfiguration)
Sets the optional DRM configuration.
-
setDrmLicenseUri
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setDrmLicenseUri(@Nullable Uri licenseUri)
Deprecated.
-
setDrmLicenseUri
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setDrmLicenseUri(@Nullable String licenseUri)
Deprecated.
-
setDrmLicenseRequestHeaders
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setDrmLicenseRequestHeaders(@Nullable Map<String,String> licenseRequestHeaders)
Deprecated.UsesetDrmConfiguration(DrmConfiguration)
andMediaItem.DrmConfiguration.Builder.setLicenseRequestHeaders(Map)
instead. Note thatMediaItem.DrmConfiguration.Builder.setLicenseRequestHeaders(Map)
doesn't accept null, use an empty map to clear the headers.
-
setDrmUuid
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setDrmUuid(@Nullable UUID uuid)
Deprecated.
-
setDrmMultiSession
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setDrmMultiSession(boolean multiSession)
Deprecated.
-
setDrmForceDefaultLicenseUri
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setDrmForceDefaultLicenseUri(boolean forceDefaultLicenseUri)
Deprecated.
-
setDrmPlayClearContentWithoutKey
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setDrmPlayClearContentWithoutKey(boolean playClearContentWithoutKey)
Deprecated.
-
setDrmSessionForClearPeriods
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setDrmSessionForClearPeriods(boolean sessionForClearPeriods)
Deprecated.
-
setDrmSessionForClearTypes
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setDrmSessionForClearTypes(@Nullable List<@TrackType Integer> sessionForClearTypes)
Deprecated.UsesetDrmConfiguration(DrmConfiguration)
andMediaItem.DrmConfiguration.Builder.setForcedSessionTrackTypes(List)
instead. Note thatMediaItem.DrmConfiguration.Builder.setForcedSessionTrackTypes(List)
doesn't accept null, use an empty list to clear the contents.
-
setDrmKeySetId
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setDrmKeySetId(@Nullable byte[] keySetId)
Deprecated.
-
setStreamKeys
@CanIgnoreReturnValue public MediaItem.Builder setStreamKeys(@Nullable List<StreamKey> streamKeys)
Sets the optional stream keys by which the manifest is filtered (only used for adaptive streams).null
or an emptyList
can be used for a reset.If
setUri(java.lang.String)
is passed a non-nulluri
, the stream keys are used to create aMediaItem.LocalConfiguration
object. Otherwise they will be ignored.
-
setCustomCacheKey
@CanIgnoreReturnValue public MediaItem.Builder setCustomCacheKey(@Nullable String customCacheKey)
Sets the optional custom cache key (only used for progressive streams).This method should only be called if
setUri(java.lang.String)
is passed a non-null value.
-
setSubtitles
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setSubtitles(@Nullable List<MediaItem.Subtitle> subtitles)
Deprecated.UsesetSubtitleConfigurations(List)
instead. Note thatsetSubtitleConfigurations(List)
doesn't accept null, use an empty list to clear the contents.
-
setSubtitleConfigurations
@CanIgnoreReturnValue public MediaItem.Builder setSubtitleConfigurations(List<MediaItem.SubtitleConfiguration> subtitleConfigurations)
Sets the optional subtitles.This method should only be called if
setUri(java.lang.String)
is passed a non-null value.
-
setAdsConfiguration
@CanIgnoreReturnValue public MediaItem.Builder setAdsConfiguration(@Nullable MediaItem.AdsConfiguration adsConfiguration)
Sets the optionalMediaItem.AdsConfiguration
.This method should only be called if
setUri(java.lang.String)
is passed a non-null value.
-
setAdTagUri
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setAdTagUri(@Nullable String adTagUri)
Deprecated.UsesetAdsConfiguration(AdsConfiguration)
, parse theadTagUri
withUri.parse(String)
and pass the result toBuilder(Uri)
instead.
-
setAdTagUri
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setAdTagUri(@Nullable Uri adTagUri)
Deprecated.
-
setAdTagUri
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setAdTagUri(@Nullable Uri adTagUri, @Nullable Object adsId)
Deprecated.UsesetAdsConfiguration(AdsConfiguration)
, pass theadTagUri
toBuilder(Uri)
and theadsId
toMediaItem.AdsConfiguration.Builder.setAdsId(Object)
instead.
-
setLiveConfiguration
@CanIgnoreReturnValue public MediaItem.Builder setLiveConfiguration(MediaItem.LiveConfiguration liveConfiguration)
Sets theMediaItem.LiveConfiguration
. Defaults toMediaItem.LiveConfiguration.UNSET
.
-
setLiveTargetOffsetMs
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setLiveTargetOffsetMs(long liveTargetOffsetMs)
-
setLiveMinOffsetMs
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setLiveMinOffsetMs(long liveMinOffsetMs)
-
setLiveMaxOffsetMs
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setLiveMaxOffsetMs(long liveMaxOffsetMs)
-
setLiveMinPlaybackSpeed
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setLiveMinPlaybackSpeed(float minPlaybackSpeed)
-
setLiveMaxPlaybackSpeed
@CanIgnoreReturnValue @Deprecated public MediaItem.Builder setLiveMaxPlaybackSpeed(float maxPlaybackSpeed)
-
setTag
@CanIgnoreReturnValue public MediaItem.Builder setTag(@Nullable Object tag)
Sets the optional tag for custom attributes. The tag for the media source which will be published in thecom.google.android.exoplayer2.Timeline
of the source ascom.google.android.exoplayer2.Timeline.Window#tag
.This method should only be called if
setUri(java.lang.String)
is passed a non-null value.
-
setMediaMetadata
@CanIgnoreReturnValue public MediaItem.Builder setMediaMetadata(MediaMetadata mediaMetadata)
Sets the media metadata.
-
setRequestMetadata
@CanIgnoreReturnValue public MediaItem.Builder setRequestMetadata(MediaItem.RequestMetadata requestMetadata)
Sets the request metadata.
-
-