Package com.castlabs.android.player
Class ErrorMediaSource
java.lang.Object
com.google.android.exoplayer2.source.BaseMediaSource
com.castlabs.android.player.ErrorMediaSource
- All Implemented Interfaces:
com.google.android.exoplayer2.source.MediaSource
public class ErrorMediaSource
extends com.google.android.exoplayer2.source.BaseMediaSource
BaseMediaSource implementation that fails immediately with a predefined error.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.android.exoplayer2.source.MediaSource
com.google.android.exoplayer2.source.MediaSource.Factory, com.google.android.exoplayer2.source.MediaSource.MediaPeriodId, com.google.android.exoplayer2.source.MediaSource.MediaSourceCaller, com.google.android.exoplayer2.source.MediaSource.SourceErrorListener -
Constructor Summary
ConstructorsConstructorDescriptionErrorMediaSource(PlayerConfig playerConfig, CastlabsPlayerException error) Creates an error source for the given playlist item.ErrorMediaSource(PlayerConfig playerConfig, IOException error) Creates an error source for the given playlist item. -
Method Summary
Modifier and TypeMethodDescriptioncom.google.android.exoplayer2.source.MediaPeriodcreatePeriod(com.google.android.exoplayer2.source.MediaSource.MediaPeriodId id, com.google.android.exoplayer2.upstream.Allocator allocator, long startPositionUs) getError()Returns the error surfaced by this source.com.google.android.exoplayer2.MediaItemReturns the playlist item associated with this source.voidvoidreleasePeriod(com.google.android.exoplayer2.source.MediaPeriod mediaPeriod) Methods inherited from class com.google.android.exoplayer2.source.BaseMediaSource
addDrmEventListener, addEventListener, disable, enable, getLiveEdge, getLiveEdge, prepareSource, prepareSource, releaseSource, removeDrmEventListener, removeEventListenerMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.google.android.exoplayer2.source.MediaSource
getInitialTimeline, isSingleWindow
-
Constructor Details
-
ErrorMediaSource
Creates an error source for the given playlist item.- Parameters:
playerConfig- The associated playlist item.error- The error to surface through ExoPlayer APIs.
-
ErrorMediaSource
Creates an error source for the given playlist item.- Parameters:
playerConfig- The associated playlist item.error- The SDK error to wrap as anIOException.
-
-
Method Details
-
getPlayerConfig
Returns the playlist item associated with this source.- Returns:
- The associated playlist item, or
nullif none was provided.
-
getError
Returns the error surfaced by this source.- Returns:
- The error surfaced by this source.
-
getMediaItem
@NonNull public com.google.android.exoplayer2.MediaItem getMediaItem() -
maybeThrowSourceInfoRefreshError
- Throws:
IOException
-
createPeriod
@NonNull public com.google.android.exoplayer2.source.MediaPeriod createPeriod(@NonNull com.google.android.exoplayer2.source.MediaSource.MediaPeriodId id, @NonNull com.google.android.exoplayer2.upstream.Allocator allocator, long startPositionUs) -
releasePeriod
public void releasePeriod(@NonNull com.google.android.exoplayer2.source.MediaPeriod mediaPeriod)
-