T - The type of the id used to identify prepared child sources.public abstract class CompositeMediaSource<T> extends java.lang.Object implements MediaSource
MediaSource consisting of multiple child sources.MediaSource.Listener, MediaSource.MediaPeriodIdMEDIA_SOURCE_REUSED_ERROR_MESSAGE| Modifier | Constructor and Description |
|---|---|
protected |
CompositeMediaSource()
Create composite media source without child sources.
|
| Modifier and Type | Method and Description |
|---|---|
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 |
prepareSource(ExoPlayer player,
boolean isTopLevelSource,
MediaSource.Listener listener)
Starts preparation of the source.
|
protected void |
releaseChildSource(T id)
Releases a child source.
|
void |
releaseSource()
Releases the source.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreatePeriod, releasePeriodprotected CompositeMediaSource()
@CallSuper public void prepareSource(ExoPlayer player, boolean isTopLevelSource, MediaSource.Listener listener)
MediaSourceShould not be called directly from application code.
prepareSource in interface MediaSourceplayer - 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). If false, this source is
being prepared by another source (e.g. ConcatenatingMediaSource) for composition.listener - The listener for source events.@CallSuper
public void maybeThrowSourceInfoRefreshError()
throws java.io.IOException
MediaSourceShould not be called directly from application code.
maybeThrowSourceInfoRefreshError in interface MediaSourcejava.io.IOException@CallSuper public void releaseSource()
MediaSourceShould not be called directly from application code.
releaseSource in interface MediaSourceprotected abstract void onChildSourceInfoRefreshed(@Nullable
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 void prepareChildSource(@Nullable
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 releaseSource().
id - A unique id to identify the child source preparation. Null is allowed as an id.mediaSource - The child MediaSource.protected void releaseChildSource(@Nullable
T id)
id - The unique id used to prepare the child source.