BaseMediaSource
@UnstableApi
abstract class BaseMediaSource : MediaSource
CompositeMediaSource |
Composite |
DashMediaSource |
A DASH |
EmptyMediaSource |
MediaSource producing an empty |
ExternallyLoadedMediaSource |
A |
FakeMediaSource |
Fake |
HlsMediaSource |
An HLS |
ProgressiveMediaSource |
Provides one period that loads data from a |
RtspMediaSource |
An Rtsp |
ServerSideAdInsertionMediaSource |
A |
SilenceMediaSource |
Media source with a single period consisting of silent raw audio of a given duration. |
SingleSampleMediaSource |
This class is deprecated. The only use for this class is subtitle playback, but it is only compatible with legacy subtitle decoding, which is not supported by default. |
SsMediaSource |
A SmoothStreaming |
AdsMediaSource |
A |
ClippingMediaSource |
|
ConcatenatingMediaSource2 |
Concatenates multiple |
ConcatenatingMediaSource |
This class is deprecated. Use playlist modification methods like addMediaItem instead. |
FakeAdaptiveMediaSource |
Fake |
FilteringMediaSource |
A |
ImaServerSideAdInsertionMediaSource |
MediaSource for IMA server side inserted ad streams. |
LoopingMediaSource |
This class is deprecated. To loop a |
MaskingMediaSource |
A |
MergingMediaSource |
Merges multiple |
PreloadMediaSource |
Preloads a |
WrappingMediaSource |
An abstract |
Base MediaSource implementation to handle parallel reuse and to keep a list of MediaSourceEventListeners.
Whenever an implementing subclass needs to provide a new timeline, it must call refreshSourceInfo to notify all listeners.
Summary
Public constructors |
|---|
Public functions |
|
|---|---|
Unit |
@UnstableApiAdds a |
Unit |
@UnstableApiAdds a |
Unit |
@UnstableApiDisables the source for the creation of |
Unit |
@UnstableApiEnables the source for the creation of |
Unit |
@UnstableApiThis function is deprecated. Implement |
Unit |
@UnstableApiRegisters a |
Unit |
Unregisters a caller, and disables and releases the source if no longer required. |
Unit |
@UnstableApiRemoves a |
Unit |
@UnstableApiRemoves a |
Protected functions |
|
|---|---|
DrmSessionEventListener.EventDispatcher! |
createDrmEventDispatcher(mediaPeriodId: MediaSource.MediaPeriodId?)Returns a |
DrmSessionEventListener.EventDispatcher! |
createDrmEventDispatcher(Returns a |
MediaSourceEventListener.EventDispatcher! |
createEventDispatcher(mediaPeriodId: MediaSource.MediaPeriodId?)Returns a |
MediaSourceEventListener.EventDispatcher! |
This function is deprecated. Use |
MediaSourceEventListener.EventDispatcher! |
createEventDispatcher(Returns a |
MediaSourceEventListener.EventDispatcher! |
This function is deprecated. Use |
Unit |
Disables the source, see |
Unit |
Enables the source, see |
Boolean |
Returns whether the source is enabled. |
Boolean |
Returns whether the source has |
abstract Unit |
prepareSourceInternal(mediaTransferListener: TransferListener?)Starts source preparation and enables the source, see |
Unit |
refreshSourceInfo(timeline: Timeline!)Updates timeline and manifest and notifies all listeners of the update. |
abstract Unit |
Releases the source, see |
Inherited functions |
||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
Public functions
addDrmEventListener
@UnstableApi
fun addDrmEventListener(
handler: Handler!,
eventListener: DrmSessionEventListener!
): Unit
Adds a DrmSessionEventListener to the list of listeners which are notified of DRM events for this media source.
Should not be called directly from application code.
This method must be called on the playback thread.
| Parameters | |
|---|---|
handler: Handler! |
A handler on the which listener events will be posted. |
eventListener: DrmSessionEventListener! |
The listener to be added. |
addEventListener
@UnstableApi
fun addEventListener(
handler: Handler!,
eventListener: MediaSourceEventListener!
): Unit
Adds a MediaSourceEventListener to the list of listeners which are notified of media source events.
Should not be called directly from application code.
This method must be called on the playback thread.
| Parameters | |
|---|---|
handler: Handler! |
A handler on the which listener events will be posted. |
eventListener: MediaSourceEventListener! |
The listener to be added. |
disable
@UnstableApi
fun disable(caller: MediaSource.MediaSourceCaller!): Unit
Disables the source for the creation of MediaPeriods. The implementation should not hold onto limited resources used for the creation of media periods.
Should not be called directly from application code.
This method must be called on the playback thread and only after all MediaPeriods previously created by createPeriod have been released by releasePeriod.
| Parameters | |
|---|---|
caller: MediaSource.MediaSourceCaller! |
The |
enable
@UnstableApi
fun enable(caller: MediaSource.MediaSourceCaller!): Unit
Enables the source for the creation of MediaPeriods.
Should not be called directly from application code.
This method must be called on the playback thread and only after prepareSource.
| Parameters | |
|---|---|
caller: MediaSource.MediaSourceCaller! |
The |
prepareSource
@UnstableApi
fun prepareSource(
caller: MediaSource.MediaSourceCaller!,
mediaTransferListener: TransferListener?
): Unit
prepareSource
@UnstableApi
fun prepareSource(
caller: MediaSource.MediaSourceCaller!,
mediaTransferListener: TransferListener?,
playerId: PlayerId!
): Unit
Registers a MediaSourceCaller. Starts source preparation if needed and enables the source for the creation of MediaPerods.
Should not be called directly from application code.
onSourceInfoRefreshed will be called once the source has a Timeline.
For each call to this method, a call to releaseSource is needed to remove the caller and to release the source if no longer required.
This method must be called on the playback thread.
| Parameters | |
|---|---|
caller: MediaSource.MediaSourceCaller! |
The |
mediaTransferListener: TransferListener? |
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 be only informed of transfers related to the media loads and not of auxiliary loads for manifests and other data. |
playerId: PlayerId! |
The |
releaseSource
@UnstableApi
fun releaseSource(caller: MediaSource.MediaSourceCaller!): Unit
Unregisters a caller, and disables and releases the source if no longer required.
Should not be called directly from application code.
This method must be called on the playback thread and only if all created MediaPeriods have been released by releasePeriod.
| Parameters | |
|---|---|
caller: MediaSource.MediaSourceCaller! |
The |
removeDrmEventListener
@UnstableApi
fun removeDrmEventListener(eventListener: DrmSessionEventListener!): Unit
Removes a DrmSessionEventListener from the list of listeners which are notified of DRM events for this media source.
Should not be called directly from application code.
This method must be called on the playback thread.
| Parameters | |
|---|---|
eventListener: DrmSessionEventListener! |
The listener to be removed. |
removeEventListener
@UnstableApi
fun removeEventListener(eventListener: MediaSourceEventListener!): Unit
Removes a MediaSourceEventListener from the list of listeners which are notified of media source events.
Should not be called directly from application code.
This method must be called on the playback thread.
| Parameters | |
|---|---|
eventListener: MediaSourceEventListener! |
The listener to be removed. |
Protected functions
createDrmEventDispatcher
protected fun createDrmEventDispatcher(mediaPeriodId: MediaSource.MediaPeriodId?): DrmSessionEventListener.EventDispatcher!
Returns a DrmSessionEventListener.EventDispatcher which dispatches all events to the registered listeners with the specified MediaPeriodId
| Parameters | |
|---|---|
mediaPeriodId: MediaSource.MediaPeriodId? |
The |
| Returns | |
|---|---|
DrmSessionEventListener.EventDispatcher! |
An event dispatcher with pre-configured media period id. |
createDrmEventDispatcher
protected fun createDrmEventDispatcher(
windowIndex: Int,
mediaPeriodId: MediaSource.MediaPeriodId?
): DrmSessionEventListener.EventDispatcher!
Returns a DrmSessionEventListener.EventDispatcher which dispatches all events to the registered listeners with the specified window index and MediaPeriodId.
| Parameters | |
|---|---|
windowIndex: Int |
The timeline window index to be reported with the events. |
mediaPeriodId: MediaSource.MediaPeriodId? |
The |
| Returns | |
|---|---|
DrmSessionEventListener.EventDispatcher! |
An event dispatcher with pre-configured media period id and time offset. |
createEventDispatcher
protected fun createEventDispatcher(mediaPeriodId: MediaSource.MediaPeriodId?): MediaSourceEventListener.EventDispatcher!
Returns a MediaSourceEventListener.EventDispatcher which dispatches all events to the registered listeners with the specified MediaPeriodId.
| Parameters | |
|---|---|
mediaPeriodId: MediaSource.MediaPeriodId? |
The |
| Returns | |
|---|---|
MediaSourceEventListener.EventDispatcher! |
An event dispatcher with pre-configured media period id. |
createEventDispatcher
protected funcreateEventDispatcher(
mediaPeriodId: MediaSource.MediaPeriodId!,
mediaTimeOffsetMs: Long
): MediaSourceEventListener.EventDispatcher!
Note: The mediaTimeOffsetMs passed to this method is ignored and not added to media times in any way.
createEventDispatcher
protected fun createEventDispatcher(
windowIndex: Int,
mediaPeriodId: MediaSource.MediaPeriodId?
): MediaSourceEventListener.EventDispatcher!
Returns a MediaSourceEventListener.EventDispatcher which dispatches all events to the registered listeners with the specified window index and MediaPeriodId.
| Parameters | |
|---|---|
windowIndex: Int |
The timeline window index to be reported with the events. |
mediaPeriodId: MediaSource.MediaPeriodId? |
The |
| Returns | |
|---|---|
MediaSourceEventListener.EventDispatcher! |
An event dispatcher with pre-configured media period id. |
createEventDispatcher
protected funcreateEventDispatcher(
windowIndex: Int,
mediaPeriodId: MediaSource.MediaPeriodId?,
mediaTimeOffsetMs: Long
): MediaSourceEventListener.EventDispatcher!
Note: The mediaTimeOffsetMs passed to this method is ignored and not added to media times in any way.
prepareSourceCalled
protected fun prepareSourceCalled(): Boolean
Returns whether the source has prepareSource called.
prepareSourceInternal
protected abstract fun prepareSourceInternal(mediaTransferListener: TransferListener?): Unit
Starts source preparation and enables the source, see prepareSource. This method is called at most once until the next call to releaseSourceInternal.
This method is called on the playback thread.
| Parameters | |
|---|---|
mediaTransferListener: TransferListener? |
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. |
refreshSourceInfo
protected fun refreshSourceInfo(timeline: Timeline!): Unit
Updates timeline and manifest and notifies all listeners of the update.
releaseSourceInternal
protected abstract fun releaseSourceInternal(): Unit
Releases the source, see releaseSource. This method is called exactly once after each call to prepareSourceInternal.
This method is called on the playback thread.