MaskingMediaSource
@UnstableApi
class MaskingMediaSource : WrappingMediaSource
A MediaSource that masks the Timeline with a placeholder until the actual media structure is known.
Summary
Nested types |
|---|
|
A timeline with one dynamic window with a period of indeterminate duration. |
Public constructors |
|---|
MaskingMediaSource(mediaSource: MediaSource!, useLazyPreparation: Boolean)Creates the masking media source. |
Public functions |
|
|---|---|
Boolean |
canUpdateMediaItem(mediaItem: MediaItem!)Returns whether the for this source can be updated with the provided item. |
MaskingMediaPeriod! |
createPeriod(Creates the requested |
Timeline! |
Returns the |
Unit |
Starts source preparation and enables the source, see |
Unit |
releasePeriod(mediaPeriod: MediaPeriod!)Releases a |
Unit |
Releases the source, see |
Unit |
updateMediaItem(mediaItem: MediaItem!)Updates the for this source. |
Protected functions |
|
|---|---|
MediaSource.MediaPeriodId? |
getMediaPeriodIdForChildMediaPeriodId(Returns the |
Unit |
onChildSourceInfoRefreshed(newTimeline: Timeline!)Called when the child source info has been refreshed. |
Inherited functions |
||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||
|
Inherited properties |
||
|---|---|---|
|
Public constructors
MaskingMediaSource
MaskingMediaSource(mediaSource: MediaSource!, useLazyPreparation: Boolean)
Creates the masking media source.
| Parameters | |
|---|---|
mediaSource: MediaSource! |
A |
useLazyPreparation: Boolean |
Whether the |
Public functions
canUpdateMediaItem
fun canUpdateMediaItem(mediaItem: MediaItem!): Boolean
Returns whether the for this source can be updated with the provided item.
Should not be called directly from application code.
This method must be called on the application thread.
This method can be overridden to change whether the MediaItem of the child source can be updated.
createPeriod
fun createPeriod(
id: MediaSource.MediaPeriodId!,
allocator: Allocator!,
startPositionUs: Long
): MaskingMediaPeriod!
Creates the requested MediaPeriod.
This method typically forwards to the wrapped media source and optionally wraps the returned MediaPeriod.
| See also | |
|---|---|
createPeriod |
prepareSourceInternal
fun prepareSourceInternal(): Unit
Starts source preparation and enables the source, see prepareSource. This method is called at most once until the next call to releaseSourceInternal.
releasePeriod
fun releasePeriod(mediaPeriod: MediaPeriod!): Unit
Releases a MediaPeriod.
This method typically forwards to the wrapped media source and optionally unwraps the provided MediaPeriod.
| See also | |
|---|---|
releasePeriod |
releaseSourceInternal
fun releaseSourceInternal(): Unit
Releases the source, see releaseSource. This method is called exactly once after each call to prepareSourceInternal.
This method is called on the playback thread.
updateMediaItem
fun updateMediaItem(mediaItem: MediaItem!): Unit
Updates the for this source.
Should not be called directly from application code.
This method must be called on the playback thread and only if #canUpdateMediaItem returns true} for the new .
This method can be overridden to change how the MediaItem of the child source is updated.
Protected functions
getMediaPeriodIdForChildMediaPeriodId
protected fun getMediaPeriodIdForChildMediaPeriodId(
mediaPeriodId: MediaSource.MediaPeriodId!
): MediaSource.MediaPeriodId?
Returns the MediaPeriodId in the wrapping source corresponding to the specified MediaPeriodId in a child source. The default implementation does not change the media period id.
| Parameters | |
|---|---|
mediaPeriodId: MediaSource.MediaPeriodId! |
A |
| Returns | |
|---|---|
MediaSource.MediaPeriodId? |
The corresponding |
onChildSourceInfoRefreshed
protected fun onChildSourceInfoRefreshed(newTimeline: Timeline!): Unit
Called when the child source info has been refreshed.
This Timeline can be amended if needed, for example using ForwardingTimeline. The Timeline for the wrapping source needs to be published with refreshSourceInfo.
| Parameters | |
|---|---|
newTimeline: Timeline! |
The timeline of the child source. |