docs/doc/reference/com/google/android/exoplayer2/source/CompositeMediaSource.html
Package com.google.android.exoplayer2.source
Type Parameters:T - The type of the id used to identify prepared child sources.All Implemented Interfaces:MediaSourceDirect Known Subclasses:AdsMediaSource, ConcatenatingMediaSource, ConcatenatingMediaSource2, ImaServerSideAdInsertionMediaSource, MergingMediaSource, WrappingMediaSource
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public abstract classCompositeMediaSource\<T\>extends[BaseMediaSource](BaseMediaSource.html "class in com.google.android.exoplayer2.source")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Composite MediaSource consisting of multiple child sources.
-
MediaSource.Factory, MediaSource.MediaPeriodId, MediaSource.MediaSourceCaller
Constructors | Modifier | Constructor | Description |
| --- | --- | --- |
| protected | CompositeMediaSource() |
Deprecated.
Creates composite media source without child sources. |
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| protected void | disableChildSource(T id) |
Deprecated.
Disables a child source.
|
| protected void | disableInternal() |
Deprecated.
Disables the source, see BaseMediaSource.disable(MediaSourceCaller).
|
| protected void | enableChildSource(T id) |
Deprecated.
Enables a child source.
|
| protected void | enableInternal() |
Deprecated.
Enables the source, see BaseMediaSource.enable(MediaSourceCaller).
|
| protected MediaSource.MediaPeriodId | getMediaPeriodIdForChildMediaPeriodId(T childSourceId, MediaSource.MediaPeriodId mediaPeriodId) |
Deprecated.
Returns the MediaSource.MediaPeriodId in the composite source corresponding to the specified MediaSource.MediaPeriodId in a child source.
|
| protected long | getMediaTimeForChildMediaTime(T childSourceId, long mediaTimeMs) |
Deprecated.
Returns the media time in the MediaPeriod of the composite source corresponding to the specified media time in the MediaPeriod of the child source.
|
| protected int | getWindowIndexForChildWindowIndex(T childSourceId, int windowIndex) |
Deprecated.
Returns the window index in the composite source corresponding to the specified window index in a child source.
|
| void | maybeThrowSourceInfoRefreshError() |
Deprecated.
Throws any pending error encountered while loading or refreshing source information.
|
| protected abstract void | onChildSourceInfoRefreshed(T childSourceId, MediaSource mediaSource, Timeline newTimeline) |
Deprecated.
Called when the source info of a child source has been refreshed.
|
| protected void | prepareChildSource(T id, MediaSource mediaSource) |
Deprecated.
Prepares a child source.
|
| protected void | prepareSourceInternal(TransferListener mediaTransferListener) |
Deprecated.
Starts source preparation and enables the source, see BaseMediaSource.prepareSource(MediaSourceCaller, TransferListener, PlayerId).
|
| protected void | releaseChildSource(T id) |
Deprecated.
Releases a child source.
|
| protected void | releaseSourceInternal() |
Deprecated.
Releases the source, see BaseMediaSource.releaseSource(MediaSourceCaller).
|
-
addDrmEventListener, addEventListener, createDrmEventDispatcher, createDrmEventDispatcher, createEventDispatcher, createEventDispatcher, createEventDispatcher, createEventDispatcher, disable, enable, getPlayerId, isEnabled, prepareSource, prepareSource, refreshSourceInfo, releaseSource, removeDrmEventListener, removeEventListener
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
createPeriod, getInitialTimeline, getMediaItem, isSingleWindow, releasePeriod
-
protected CompositeMediaSource()
Deprecated.
Creates composite media source without child sources.
-
@CallSuper
protected void prepareSourceInternal(@Nullable[TransferListener](../upstream/TransferListener.html "interface in com.google.android.exoplayer2.upstream")mediaTransferListener)
Deprecated.
Description copied from class: BaseMediaSource
Starts source preparation and enables the source, see BaseMediaSource.prepareSource(MediaSourceCaller, TransferListener, PlayerId). This method is called at most once until the next call to BaseMediaSource.releaseSourceInternal().
Specified by:prepareSourceInternal in class BaseMediaSourceParameters: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[IOException](https://developer.android.com/reference/java/io/IOException.html "class or interface in java.io")
Deprecated.
Description copied from interface: MediaSource
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 MediaSource.prepareSource(MediaSourceCaller, TransferListener, PlayerId).
Throws:IOException
-
@CallSuper
protected void enableInternal()
Deprecated.
Description copied from class: BaseMediaSource
Enables the source, see BaseMediaSource.enable(MediaSourceCaller).
Overrides:enableInternal in class BaseMediaSource
-
@CallSuper
protected void disableInternal()
Deprecated.
Description copied from class: BaseMediaSource
Disables the source, see BaseMediaSource.disable(MediaSourceCaller).
Overrides:disableInternal in class BaseMediaSource
-
@CallSuper
protected void releaseSourceInternal()
Deprecated.
Description copied from class: BaseMediaSource
Releases the source, see BaseMediaSource.releaseSource(MediaSourceCaller). This method is called exactly once after each call to BaseMediaSource.prepareSourceInternal(TransferListener).
Specified by:releaseSourceInternal in class BaseMediaSource
-
protected abstract void onChildSourceInfoRefreshed([T](CompositeMediaSource.html "type parameter in CompositeMediaSource")childSourceId,[MediaSource](MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource,[Timeline](../Timeline.html "class in com.google.android.exoplayer2")newTimeline)
Deprecated.
Called when the source info of a child source has been refreshed.
Parameters:childSourceId - The unique id used to prepare the child source.mediaSource - The child source whose source info has been refreshed.newTimeline - The timeline of the child source.
-
protected final void prepareChildSource([T](CompositeMediaSource.html "type parameter in CompositeMediaSource")id,[MediaSource](MediaSource.html "interface in com.google.android.exoplayer2.source")mediaSource)
Deprecated.
Prepares a child source.
onChildSourceInfoRefreshed(Object, MediaSource, Timeline) will be called when the child source updates its timeline with the same id passed to this method.
Any child sources that aren't explicitly released with releaseChildSource(Object) will be released in releaseSourceInternal().
Parameters:id - A unique id to identify the child source preparation. Null is allowed as an id.mediaSource - The child MediaSource.
-
protected final void enableChildSource([T](CompositeMediaSource.html "type parameter in CompositeMediaSource")id)
Deprecated.
Enables a child source.
Parameters:id - The unique id used to prepare the child source.
-
protected final void disableChildSource([T](CompositeMediaSource.html "type parameter in CompositeMediaSource")id)
Deprecated.
Disables a child source.
Parameters:id - The unique id used to prepare the child source.
-
protected final void releaseChildSource([T](CompositeMediaSource.html "type parameter in CompositeMediaSource")id)
Deprecated.
Releases a child source.
Parameters:id - The unique id used to prepare the child source.
-
protected int getWindowIndexForChildWindowIndex([T](CompositeMediaSource.html "type parameter in CompositeMediaSource")childSourceId,
int windowIndex)
Deprecated.
Returns the window index in the composite source corresponding to the specified window index in a child source. The default implementation does not change the window index.
Parameters:childSourceId - The unique id used to prepare the child source.windowIndex - A window index of the child source.Returns:The corresponding window index in the composite source.
-
@Nullable
protected[MediaSource.MediaPeriodId](MediaSource.MediaPeriodId.html "class in com.google.android.exoplayer2.source")getMediaPeriodIdForChildMediaPeriodId([T](CompositeMediaSource.html "type parameter in CompositeMediaSource")childSourceId,[MediaSource.MediaPeriodId](MediaSource.MediaPeriodId.html "class in com.google.android.exoplayer2.source")mediaPeriodId)
Deprecated.
Returns the MediaSource.MediaPeriodId in the composite source corresponding to the specified MediaSource.MediaPeriodId in a child source. The default implementation does not change the media period id.
Parameters:childSourceId - The unique id used to prepare the child source.mediaPeriodId - A MediaSource.MediaPeriodId of the child source.Returns:The corresponding MediaSource.MediaPeriodId in the composite source. Null if no corresponding media period id can be determined.
-
protected long getMediaTimeForChildMediaTime([T](CompositeMediaSource.html "type parameter in CompositeMediaSource")childSourceId,
long mediaTimeMs)
Deprecated.
Returns the media time in the MediaPeriod of the composite source corresponding to the specified media time in the MediaPeriod of the child source. The default implementation does not change the media time.
Parameters:childSourceId - The unique id used to prepare the child source.mediaTimeMs - A media time in the MediaPeriod of the child source, in milliseconds.Returns:The corresponding media time in the MediaPeriod of the composite source, in milliseconds.