Class CompositeMediaSource<T>
- java.lang.Object
-
- com.google.android.exoplayer2.source.BaseMediaSource
-
- com.google.android.exoplayer2.source.CompositeMediaSource<T>
-
- Type Parameters:
T
- The type of the id used to identify prepared child sources.
- All Implemented Interfaces:
MediaSource
- Direct Known Subclasses:
AdsMediaSource
,ConcatenatingMediaSource
,ConcatenatingMediaSource2
,ImaServerSideAdInsertionMediaSource
,MergingMediaSource
,WrappingMediaSource
@Deprecated public abstract class CompositeMediaSource<T> extends BaseMediaSource
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.CompositeMediaSource
consisting of multiple child sources.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.source.MediaSource
MediaSource.Factory, MediaSource.MediaPeriodId, MediaSource.MediaSourceCaller
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CompositeMediaSource()
Deprecated.Creates composite media source without child sources.
-
Method Summary
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, seeBaseMediaSource.disable(MediaSourceCaller)
.protected void
enableChildSource(T id)
Deprecated.Enables a child source.protected void
enableInternal()
Deprecated.Enables the source, seeBaseMediaSource.enable(MediaSourceCaller)
.protected MediaSource.MediaPeriodId
getMediaPeriodIdForChildMediaPeriodId(T childSourceId, MediaSource.MediaPeriodId mediaPeriodId)
Deprecated.Returns theMediaSource.MediaPeriodId
in the composite source corresponding to the specifiedMediaSource.MediaPeriodId
in a child source.protected long
getMediaTimeForChildMediaTime(T childSourceId, long mediaTimeMs)
Deprecated.Returns the media time in theMediaPeriod
of the composite source corresponding to the specified media time in theMediaPeriod
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, seeBaseMediaSource.prepareSource(MediaSourceCaller, TransferListener, PlayerId)
.protected void
releaseChildSource(T id)
Deprecated.Releases a child source.protected void
releaseSourceInternal()
Deprecated.Releases the source, seeBaseMediaSource.releaseSource(MediaSourceCaller)
.-
Methods inherited from class com.google.android.exoplayer2.source.BaseMediaSource
addDrmEventListener, addEventListener, createDrmEventDispatcher, createDrmEventDispatcher, createEventDispatcher, createEventDispatcher, createEventDispatcher, createEventDispatcher, disable, enable, getPlayerId, isEnabled, prepareSource, prepareSource, refreshSourceInfo, releaseSource, removeDrmEventListener, removeEventListener
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.google.android.exoplayer2.source.MediaSource
createPeriod, getInitialTimeline, getMediaItem, isSingleWindow, releasePeriod
-
-
-
-
Method Detail
-
prepareSourceInternal
@CallSuper protected void prepareSourceInternal(@Nullable TransferListener mediaTransferListener)
Deprecated.Description copied from class:BaseMediaSource
Starts source preparation and enables the source, seeBaseMediaSource.prepareSource(MediaSourceCaller, TransferListener, PlayerId)
. This method is called at most once until the next call toBaseMediaSource.releaseSourceInternal()
.- Specified by:
prepareSourceInternal
in classBaseMediaSource
- Parameters:
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.
-
maybeThrowSourceInfoRefreshError
@CallSuper public void maybeThrowSourceInfoRefreshError() throws IOException
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
-
enableInternal
@CallSuper protected void enableInternal()
Deprecated.Description copied from class:BaseMediaSource
Enables the source, seeBaseMediaSource.enable(MediaSourceCaller)
.- Overrides:
enableInternal
in classBaseMediaSource
-
disableInternal
@CallSuper protected void disableInternal()
Deprecated.Description copied from class:BaseMediaSource
Disables the source, seeBaseMediaSource.disable(MediaSourceCaller)
.- Overrides:
disableInternal
in classBaseMediaSource
-
releaseSourceInternal
@CallSuper protected void releaseSourceInternal()
Deprecated.Description copied from class:BaseMediaSource
Releases the source, seeBaseMediaSource.releaseSource(MediaSourceCaller)
. This method is called exactly once after each call toBaseMediaSource.prepareSourceInternal(TransferListener)
.- Specified by:
releaseSourceInternal
in classBaseMediaSource
-
onChildSourceInfoRefreshed
protected abstract void onChildSourceInfoRefreshed(T childSourceId, MediaSource mediaSource, Timeline 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.
-
prepareChildSource
protected final void prepareChildSource(T id, MediaSource mediaSource)
Deprecated.Prepares a child source.onChildSourceInfoRefreshed(Object, MediaSource, Timeline)
will be called when the child source updates its timeline with the sameid
passed to this method.Any child sources that aren't explicitly released with
releaseChildSource(Object)
will be released inreleaseSourceInternal()
.- Parameters:
id
- A unique id to identify the child source preparation. Null is allowed as an id.mediaSource
- The childMediaSource
.
-
enableChildSource
protected final void enableChildSource(T id)
Deprecated.Enables a child source.- Parameters:
id
- The unique id used to prepare the child source.
-
disableChildSource
protected final void disableChildSource(T id)
Deprecated.Disables a child source.- Parameters:
id
- The unique id used to prepare the child source.
-
releaseChildSource
protected final void releaseChildSource(T id)
Deprecated.Releases a child source.- Parameters:
id
- The unique id used to prepare the child source.
-
getWindowIndexForChildWindowIndex
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. 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.
-
getMediaPeriodIdForChildMediaPeriodId
@Nullable protected MediaSource.MediaPeriodId getMediaPeriodIdForChildMediaPeriodId(T childSourceId, MediaSource.MediaPeriodId mediaPeriodId)
Deprecated.Returns theMediaSource.MediaPeriodId
in the composite source corresponding to the specifiedMediaSource.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
- AMediaSource.MediaPeriodId
of the child source.- Returns:
- The corresponding
MediaSource.MediaPeriodId
in the composite source. Null if no corresponding media period id can be determined.
-
getMediaTimeForChildMediaTime
protected long getMediaTimeForChildMediaTime(T childSourceId, long mediaTimeMs)
Deprecated.Returns the media time in theMediaPeriod
of the composite source corresponding to the specified media time in theMediaPeriod
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 theMediaPeriod
of the child source, in milliseconds.- Returns:
- The corresponding media time in the
MediaPeriod
of the composite source, in milliseconds.
-
-