MediaItem.Builder
class MediaItem.Builder
A builder for MediaItem instances.
Summary
Public constructors |
|---|
Builder()Creates a builder. |
Public constructors
Public functions
setAdTagUri
@CanIgnoreReturnValue
@UnstableApi
funsetAdTagUri(adTagUri: Uri?, adsId: Any?): MediaItem.Builder!
setAdsConfiguration
@CanIgnoreReturnValue
fun setAdsConfiguration(adsConfiguration: MediaItem.AdsConfiguration?): MediaItem.Builder!
Sets the optional AdsConfiguration.
This method should only be called if setUri is passed a non-null value.
setClipEndPositionMs
@CanIgnoreReturnValue
@UnstableApi
funsetClipEndPositionMs(endPositionMs: Long): MediaItem.Builder!
setClipRelativeToDefaultPosition
@CanIgnoreReturnValue
@UnstableApi
funsetClipRelativeToDefaultPosition(relativeToDefaultPosition: Boolean): MediaItem.Builder!
setClipRelativeToLiveWindow
@CanIgnoreReturnValue
@UnstableApi
funsetClipRelativeToLiveWindow(relativeToLiveWindow: Boolean): MediaItem.Builder!
setClipStartPositionMs
@CanIgnoreReturnValue
@UnstableApi
funsetClipStartPositionMs(startPositionMs: @IntRange(from = 0) Long): MediaItem.Builder!
setClipStartsAtKeyFrame
@CanIgnoreReturnValue
@UnstableApi
funsetClipStartsAtKeyFrame(startsAtKeyFrame: Boolean): MediaItem.Builder!
setClippingConfiguration
@CanIgnoreReturnValue
fun setClippingConfiguration(
clippingConfiguration: MediaItem.ClippingConfiguration!
): MediaItem.Builder!
Sets the ClippingConfiguration, defaults to UNSET.
setCustomCacheKey
@CanIgnoreReturnValue
@UnstableApi
fun setCustomCacheKey(customCacheKey: String?): MediaItem.Builder!
Sets the optional custom cache key (only used for progressive streams).
This method should only be called if setUri is passed a non-null value.
setDrmConfiguration
@CanIgnoreReturnValue
fun setDrmConfiguration(drmConfiguration: MediaItem.DrmConfiguration?): MediaItem.Builder!
Sets the optional DRM configuration.
setDrmForceDefaultLicenseUri
@CanIgnoreReturnValue
@UnstableApi
funsetDrmForceDefaultLicenseUri(forceDefaultLicenseUri: Boolean): MediaItem.Builder!
setDrmKeySetId
@CanIgnoreReturnValue
@UnstableApi
funsetDrmKeySetId(keySetId: ByteArray?): MediaItem.Builder!
setDrmLicenseRequestHeaders
@CanIgnoreReturnValue
@UnstableApi
funsetDrmLicenseRequestHeaders(
licenseRequestHeaders: (Mutable)Map<String!, String!>?
): MediaItem.Builder!
setDrmLicenseUri
@CanIgnoreReturnValue
@UnstableApi
funsetDrmLicenseUri(licenseUri: String?): MediaItem.Builder!
setDrmLicenseUri
@CanIgnoreReturnValue
@UnstableApi
funsetDrmLicenseUri(licenseUri: Uri?): MediaItem.Builder!
setDrmMultiSession
@CanIgnoreReturnValue
@UnstableApi
funsetDrmMultiSession(multiSession: Boolean): MediaItem.Builder!
setDrmPlayClearContentWithoutKey
@CanIgnoreReturnValue
@UnstableApi
funsetDrmPlayClearContentWithoutKey(playClearContentWithoutKey: Boolean): MediaItem.Builder!
setDrmSessionForClearPeriods
@CanIgnoreReturnValue
@UnstableApi
funsetDrmSessionForClearPeriods(sessionForClearPeriods: Boolean): MediaItem.Builder!
setDrmSessionForClearTypes
@CanIgnoreReturnValue
@UnstableApi
funsetDrmSessionForClearTypes(
sessionForClearTypes: (Mutable)List<@C.TrackType Int!>?
): MediaItem.Builder!
setImageDurationMs
@CanIgnoreReturnValue
@UnstableApi
fun setImageDurationMs(imageDurationMs: Long): MediaItem.Builder!
Sets the image duration in video output, in milliseconds.
Must be set if the URI is set and resolves to an image. Ignored otherwise.
Motion photos will be rendered as images if this parameter is set, and as videos otherwise.
Default value is TIME_UNSET.
setLiveConfiguration
@CanIgnoreReturnValue
fun setLiveConfiguration(liveConfiguration: MediaItem.LiveConfiguration!): MediaItem.Builder!
Sets the LiveConfiguration. Defaults to UNSET.
setLiveMaxOffsetMs
@CanIgnoreReturnValue
@UnstableApi
funsetLiveMaxOffsetMs(liveMaxOffsetMs: Long): MediaItem.Builder!
setLiveMaxPlaybackSpeed
@CanIgnoreReturnValue
@UnstableApi
funsetLiveMaxPlaybackSpeed(maxPlaybackSpeed: Float): MediaItem.Builder!
setLiveMinOffsetMs
@CanIgnoreReturnValue
@UnstableApi
funsetLiveMinOffsetMs(liveMinOffsetMs: Long): MediaItem.Builder!
setLiveMinPlaybackSpeed
@CanIgnoreReturnValue
@UnstableApi
funsetLiveMinPlaybackSpeed(minPlaybackSpeed: Float): MediaItem.Builder!
setLiveTargetOffsetMs
@CanIgnoreReturnValue
@UnstableApi
funsetLiveTargetOffsetMs(liveTargetOffsetMs: Long): MediaItem.Builder!
setMediaId
@CanIgnoreReturnValue
fun setMediaId(mediaId: String!): MediaItem.Builder!
Sets the optional media ID which identifies the media item.
By default DEFAULT_MEDIA_ID is used.
setMediaMetadata
@CanIgnoreReturnValue
fun setMediaMetadata(mediaMetadata: MediaMetadata!): MediaItem.Builder!
Sets the media metadata.
setMimeType
@CanIgnoreReturnValue
fun setMimeType(mimeType: String?): MediaItem.Builder!
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 is passed a non-null value.
| Parameters | |
|---|---|
mimeType: String? |
The MIME type. |
setRequestMetadata
@CanIgnoreReturnValue
fun setRequestMetadata(requestMetadata: MediaItem.RequestMetadata!): MediaItem.Builder!
Sets the request metadata.
setStreamKeys
@CanIgnoreReturnValue
@UnstableApi
fun setStreamKeys(streamKeys: (Mutable)List<StreamKey!>?): MediaItem.Builder!
Sets the optional stream keys by which the manifest is filtered (only used for adaptive streams).
null or an empty List can be used for a reset.
If setUri is passed a non-null uri, the stream keys are used to create a LocalConfiguration object. Otherwise they will be ignored.
setSubtitleConfigurations
@CanIgnoreReturnValue
fun setSubtitleConfigurations(
subtitleConfigurations: (Mutable)List<MediaItem.SubtitleConfiguration!>!
): MediaItem.Builder!
Sets the optional subtitles.
This method should only be called if setUri is passed a non-null value.
setSubtitles
@CanIgnoreReturnValue
@UnstableApi
funsetSubtitles(subtitles: (Mutable)List<MediaItem.Subtitle!>?): MediaItem.Builder!
setTag
@CanIgnoreReturnValue
fun setTag(tag: Any?): MediaItem.Builder!
Sets the optional tag for custom attributes. The tag for the media source which will be published in the androidx.media3.common.Timeline of the source as
androidx.media3.common.Timeline.Window#tag.
This method should only be called if setUri is passed a non-null value.
setUri
@CanIgnoreReturnValue
fun setUri(uri: String?): MediaItem.Builder!
Sets the optional URI.
If uri is null or unset then no LocalConfiguration object is created during build and no other Builder methods that would populate localConfiguration should be called.
setUri
@CanIgnoreReturnValue
fun setUri(uri: Uri?): MediaItem.Builder!
Sets the optional URI.
If uri is null or unset then no LocalConfiguration object is created during build and no other Builder methods that would populate localConfiguration should be called.