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
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
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
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
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
public MediaItem.Builder setClippingConfiguration(MediaItem.ClippingConfiguration clippingConfiguration)
Sets theMediaItem.ClippingConfiguration
, defaults toMediaItem.ClippingConfiguration.UNSET
.
-
setClipStartPositionMs
@Deprecated public MediaItem.Builder setClipStartPositionMs(@IntRange(from=0L) long startPositionMs)
Deprecated.
-
setClipEndPositionMs
@Deprecated public MediaItem.Builder setClipEndPositionMs(long endPositionMs)
Deprecated.
-
setClipRelativeToLiveWindow
@Deprecated public MediaItem.Builder setClipRelativeToLiveWindow(boolean relativeToLiveWindow)
Deprecated.
-
setClipRelativeToDefaultPosition
@Deprecated public MediaItem.Builder setClipRelativeToDefaultPosition(boolean relativeToDefaultPosition)
-
setClipStartsAtKeyFrame
@Deprecated public MediaItem.Builder setClipStartsAtKeyFrame(boolean startsAtKeyFrame)
Deprecated.
-
setDrmConfiguration
public MediaItem.Builder setDrmConfiguration(@Nullable MediaItem.DrmConfiguration drmConfiguration)
Sets the optional DRM configuration.
-
setDrmLicenseUri
@Deprecated public MediaItem.Builder setDrmLicenseUri(@Nullable Uri licenseUri)
Deprecated.
-
setDrmLicenseUri
@Deprecated public MediaItem.Builder setDrmLicenseUri(@Nullable String licenseUri)
Deprecated.
-
setDrmLicenseRequestHeaders
@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
@Deprecated public MediaItem.Builder setDrmUuid(@Nullable UUID uuid)
Deprecated.
-
setDrmMultiSession
@Deprecated public MediaItem.Builder setDrmMultiSession(boolean multiSession)
Deprecated.
-
setDrmForceDefaultLicenseUri
@Deprecated public MediaItem.Builder setDrmForceDefaultLicenseUri(boolean forceDefaultLicenseUri)
Deprecated.
-
setDrmPlayClearContentWithoutKey
@Deprecated public MediaItem.Builder setDrmPlayClearContentWithoutKey(boolean playClearContentWithoutKey)
Deprecated.
-
setDrmSessionForClearPeriods
@Deprecated public MediaItem.Builder setDrmSessionForClearPeriods(boolean sessionForClearPeriods)
Deprecated.
-
setDrmSessionForClearTypes
@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
@Deprecated public MediaItem.Builder setDrmKeySetId(@Nullable byte[] keySetId)
Deprecated.
-
setStreamKeys
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
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
@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
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
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
@Deprecated public MediaItem.Builder setAdTagUri(@Nullable String adTagUri)
Deprecated.UsesetAdsConfiguration(AdsConfiguration)
, parse theadTagUri
withUri.parse(String)
and pass the result toBuilder(Uri)
instead.
-
setAdTagUri
@Deprecated public MediaItem.Builder setAdTagUri(@Nullable Uri adTagUri)
Deprecated.
-
setAdTagUri
@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
public MediaItem.Builder setLiveConfiguration(MediaItem.LiveConfiguration liveConfiguration)
Sets theMediaItem.LiveConfiguration
. Defaults toMediaItem.LiveConfiguration.UNSET
.
-
setLiveTargetOffsetMs
@Deprecated public MediaItem.Builder setLiveTargetOffsetMs(long liveTargetOffsetMs)
-
setLiveMinOffsetMs
@Deprecated public MediaItem.Builder setLiveMinOffsetMs(long liveMinOffsetMs)
-
setLiveMaxOffsetMs
@Deprecated public MediaItem.Builder setLiveMaxOffsetMs(long liveMaxOffsetMs)
-
setLiveMinPlaybackSpeed
@Deprecated public MediaItem.Builder setLiveMinPlaybackSpeed(float minPlaybackSpeed)
-
setLiveMaxPlaybackSpeed
@Deprecated public MediaItem.Builder setLiveMaxPlaybackSpeed(float maxPlaybackSpeed)
-
setTag
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
public MediaItem.Builder setMediaMetadata(MediaMetadata mediaMetadata)
Sets the media metadata.
-
-