public final class ConcatenatingMediaSource extends CompositeMediaSource<java.lang.Integer>
MediaSources. It is valid for the same MediaSource instance
to be present more than once in the concatenation.MediaSource.Listener, MediaSource.MediaPeriodIdMEDIA_SOURCE_REUSED_ERROR_MESSAGE| Constructor and Description |
|---|
ConcatenatingMediaSource(boolean isAtomic,
MediaSource... mediaSources) |
ConcatenatingMediaSource(boolean isAtomic,
ShuffleOrder shuffleOrder,
MediaSource... mediaSources) |
ConcatenatingMediaSource(MediaSource... mediaSources) |
| Modifier and Type | Method and Description |
|---|---|
MediaPeriod |
createPeriod(MediaSource.MediaPeriodId id,
Allocator allocator)
Returns a new
MediaPeriod identified by periodId. |
protected void |
onChildSourceInfoRefreshed(java.lang.Integer sourceFirstIndex,
MediaSource mediaSource,
Timeline sourceTimeline,
java.lang.Object sourceManifest)
Called when the source info of a child source has been refreshed.
|
void |
prepareSource(ExoPlayer player,
boolean isTopLevelSource,
MediaSource.Listener listener)
Starts preparation of the source.
|
void |
releasePeriod(MediaPeriod mediaPeriod)
Releases the period.
|
void |
releaseSource()
Releases the source.
|
maybeThrowSourceInfoRefreshError, prepareChildSource, releaseChildSourcepublic ConcatenatingMediaSource(MediaSource... mediaSources)
mediaSources - The MediaSources to concatenate. It is valid for the same
MediaSource instance to be present more than once in the array.public ConcatenatingMediaSource(boolean isAtomic,
MediaSource... mediaSources)
isAtomic - Whether the concatenated media source shall be treated as atomic,
i.e., treated as a single item for repeating and shuffling.mediaSources - The MediaSources to concatenate. It is valid for the same
MediaSource instance to be present more than once in the array.public ConcatenatingMediaSource(boolean isAtomic,
ShuffleOrder shuffleOrder,
MediaSource... mediaSources)
isAtomic - Whether the concatenated media source shall be treated as atomic,
i.e., treated as a single item for repeating and shuffling.shuffleOrder - The ShuffleOrder to use when shuffling the child media sources. The
number of elements in the shuffle order must match the number of concatenated
MediaSources.mediaSources - The MediaSources to concatenate. It is valid for the same
MediaSource instance to be present more than once in the array.public void prepareSource(ExoPlayer player, boolean isTopLevelSource, MediaSource.Listener listener)
MediaSourceShould not be called directly from application code.
prepareSource in interface MediaSourceprepareSource in class CompositeMediaSource<java.lang.Integer>player - 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.public MediaPeriod createPeriod(MediaSource.MediaPeriodId id, Allocator allocator)
MediaSourceMediaPeriod identified by periodId. This method may be called
multiple times with the same period identifier without an intervening call to
MediaSource.releasePeriod(MediaPeriod).
Should not be called directly from application code.
id - The identifier of the period.allocator - An Allocator from which to obtain media buffer allocations.MediaPeriod.public void releasePeriod(MediaPeriod mediaPeriod)
MediaSourceShould not be called directly from application code.
mediaPeriod - The period to release.public void releaseSource()
MediaSourceShould not be called directly from application code.
releaseSource in interface MediaSourcereleaseSource in class CompositeMediaSource<java.lang.Integer>protected void onChildSourceInfoRefreshed(java.lang.Integer sourceFirstIndex,
MediaSource mediaSource,
Timeline sourceTimeline,
@Nullable
java.lang.Object sourceManifest)
CompositeMediaSourceonChildSourceInfoRefreshed in class CompositeMediaSource<java.lang.Integer>sourceFirstIndex - The unique id used to prepare the child source.mediaSource - The child source whose source info has been refreshed.sourceTimeline - The timeline of the child source.sourceManifest - The manifest of the child source.