T - The type of the id used to identify prepared child sources.public abstract class CompositeMediaSource<T> extends BaseMediaSource
MediaSource consisting of multiple child sources.MediaSource.MediaPeriodId, MediaSource.SourceInfoRefreshListener| Modifier | Constructor and Description |
|---|---|
protected |
CompositeMediaSource()
Create composite media source without child sources.
|
| Modifier and Type | Method and Description |
|---|---|
protected MediaSource.MediaPeriodId |
getMediaPeriodIdForChildMediaPeriodId(T id,
MediaSource.MediaPeriodId mediaPeriodId)
Returns the
MediaPeriodId in the composite source corresponding to the specified MediaPeriodId in a child source. |
protected long |
getMediaTimeForChildMediaTime(T id,
long mediaTimeMs)
Returns the media time in the composite source corresponding to the specified media time in a
child source.
|
protected int |
getWindowIndexForChildWindowIndex(T id,
int windowIndex)
Returns the window index in the composite source corresponding to the specified window index in
a child source.
|
void |
maybeThrowSourceInfoRefreshError()
Throws any pending error encountered while loading or refreshing source information.
|
protected abstract void |
onChildSourceInfoRefreshed(T id,
MediaSource mediaSource,
Timeline timeline,
java.lang.Object manifest)
Called when the source info of a child source has been refreshed.
|
protected void |
prepareChildSource(T id,
MediaSource mediaSource)
Prepares a child source.
|
void |
prepareSourceInternal(ExoPlayer player,
boolean isTopLevelSource,
TransferListener mediaTransferListener)
Starts source preparation.
|
protected void |
releaseChildSource(T id)
Releases a child source.
|
void |
releaseSourceInternal()
Releases the source.
|
addEventListener, createEventDispatcher, createEventDispatcher, createEventDispatcher, prepareSource, prepareSource, refreshSourceInfo, releaseSource, removeEventListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreatePeriod, releasePeriodprotected CompositeMediaSource()
@CallSuper public void prepareSourceInternal(ExoPlayer player, boolean isTopLevelSource, @Nullable TransferListener mediaTransferListener)
BaseMediaSourceBaseMediaSource.releaseSourceInternal().prepareSourceInternal in class BaseMediaSourceplayer - The player for which this source is being prepared.isTopLevelSource - Whether this source has been passed directly to ExoPlayer.prepare(MediaSource) or ExoPlayer.prepare(MediaSource, boolean,
boolean).mediaTransferListener - The transfer listener which should be informed of any media data
transfers. May be null if no listener is available. Note that this listener should usually
be only informed of transfers related to the media loads and not of auxiliary loads for
manifests and other data.@CallSuper
public void maybeThrowSourceInfoRefreshError()
throws java.io.IOException
MediaSourceShould not be called directly from application code.
java.io.IOException@CallSuper public void releaseSourceInternal()
BaseMediaSourceBaseMediaSource.prepareSourceInternal(ExoPlayer, boolean, TransferListener).releaseSourceInternal in class BaseMediaSourceprotected abstract void onChildSourceInfoRefreshed(T id, MediaSource mediaSource, Timeline timeline, @Nullable java.lang.Object manifest)
id - The unique id used to prepare the child source.mediaSource - The child source whose source info has been refreshed.timeline - The timeline of the child source.manifest - The manifest of the child source.protected final void prepareChildSource(T id, MediaSource mediaSource)
onChildSourceInfoRefreshed(Object, MediaSource, Timeline, Object) will be called
when the child source updates its timeline and/or manifest with the same id passed to
this method.
Any child sources that aren't explicitly released with releaseChildSource(Object)
will be released in releaseSourceInternal().
id - A unique id to identify the child source preparation. Null is allowed as an id.mediaSource - The child MediaSource.protected final void releaseChildSource(T id)
id - The unique id used to prepare the child source.protected int getWindowIndexForChildWindowIndex(T id, int windowIndex)
id - The unique id used to prepare the child source.windowIndex - A window index of the child source.@Nullable protected MediaSource.MediaPeriodId getMediaPeriodIdForChildMediaPeriodId(T id, MediaSource.MediaPeriodId mediaPeriodId)
MediaPeriodId in the composite source corresponding to the specified MediaPeriodId in a child source. The default implementation does not change the media period
id.id - The unique id used to prepare the child source.mediaPeriodId - A MediaPeriodId of the child source.MediaPeriodId in the composite source. Null if no
corresponding media period id can be determined.protected long getMediaTimeForChildMediaTime(@Nullable
T id,
long mediaTimeMs)
id - The unique id used to prepare the child source.mediaTimeMs - A media time of the child source, in milliseconds.