ClippingMediaSource
@UnstableApi
public final class ClippingMediaSource extends WrappingMediaSource
MediaSource that wraps a source and clips its timeline based on specified start/end positions. The wrapped source must consist of a single period.
Summary
Nested types |
|---|
public final class ClippingMediaSource.BuilderA builder for |
public final class ClippingMediaSource.IllegalClippingException extends IOExceptionThrown when a |
@DocumentedThe reason clipping failed. |
Public constructors |
|---|
This method is deprecated. Use |
This method is deprecated. Use |
This method is deprecated. Use |
Public methods |
|
|---|---|
boolean |
canUpdateMediaItem(MediaItem mediaItem)Returns whether the for this source can be updated with the provided item. |
MediaPeriod |
createPeriod(Creates the requested |
void |
Throws any pending error encountered while loading or refreshing source information. |
void |
releasePeriod(MediaPeriod mediaPeriod)Releases a |
Protected methods |
|
|---|---|
void |
onChildSourceInfoRefreshed(Timeline newTimeline)Called when the child source info has been refreshed. |
void |
Releases the source, see |
Inherited fields |
||
|---|---|---|
|
Inherited methods |
||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||
|
Public constructors
ClippingMediaSource
publicClippingMediaSource(
MediaSource mediaSource,
long startPositionUs,
long endPositionUs
)
ClippingMediaSource
publicClippingMediaSource(
MediaSource mediaSource,
long startPositionUs,
long endPositionUs,
boolean enableInitialDiscontinuity,
boolean allowDynamicClippingUpdates,
boolean relativeToDefaultPosition
)
Public methods
canUpdateMediaItem
public boolean canUpdateMediaItem(MediaItem mediaItem)
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
public MediaPeriod createPeriod(
MediaSource.MediaPeriodId id,
Allocator allocator,
long startPositionUs
)
Creates the requested MediaPeriod.
This method typically forwards to the wrapped media source and optionally wraps the returned MediaPeriod.
| See also | |
|---|---|
createPeriod |
maybeThrowSourceInfoRefreshError
public void maybeThrowSourceInfoRefreshError()
Throws any pending error encountered while loading or refreshing source information.
Should not be called directly from application code.
This method must be called on the playback thread and only after prepareSource.
| Throws | |
|---|---|
java.io.IOException |
releasePeriod
public void releasePeriod(MediaPeriod mediaPeriod)
Releases a MediaPeriod.
This method typically forwards to the wrapped media source and optionally unwraps the provided MediaPeriod.
| See also | |
|---|---|
releasePeriod |
Protected methods
onChildSourceInfoRefreshed
protected void onChildSourceInfoRefreshed(Timeline newTimeline)
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 | |
|---|---|
Timeline newTimeline |
The timeline of the child source. |
releaseSourceInternal
protected void releaseSourceInternal()
Releases the source, see releaseSource. This method is called exactly once after each call to prepareSourceInternal.
This method is called on the playback thread.