public final class HlsMediaPeriod extends java.lang.Object implements com.google.android.exoplayer2.source.MediaPeriod, com.google.android.exoplayer2.source.hls.HlsSampleStreamWrapper.Callback, HlsPlaylistTracker.PlaylistEventListener
MediaPeriod that loads an HLS stream.| Constructor and Description |
|---|
HlsMediaPeriod(HlsExtractorFactory extractorFactory,
HlsPlaylistTracker playlistTracker,
HlsDataSourceFactory dataSourceFactory,
int minLoadableRetryCount,
com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher eventDispatcher,
com.google.android.exoplayer2.upstream.Allocator allocator,
com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory,
boolean allowChunklessPreparation) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
continueLoading(long positionUs) |
void |
discardBuffer(long positionUs,
boolean toKeyframe) |
long |
getAdjustedSeekPositionUs(long positionUs,
com.google.android.exoplayer2.SeekParameters seekParameters) |
long |
getBufferedPositionUs() |
long |
getNextLoadPositionUs() |
com.google.android.exoplayer2.source.TrackGroupArray |
getTrackGroups() |
void |
maybeThrowPrepareError() |
void |
onContinueLoadingRequested(com.google.android.exoplayer2.source.hls.HlsSampleStreamWrapper sampleStreamWrapper) |
void |
onPlaylistBlacklisted(HlsMasterPlaylist.HlsUrl url,
long blacklistMs)
Called if an error is encountered while loading a playlist.
|
void |
onPlaylistChanged()
Called a playlist changes.
|
void |
onPlaylistRefreshRequired(HlsMasterPlaylist.HlsUrl url)
Called to schedule a
SequenceableLoader.continueLoading(long) call when the playlist referred by the
given url changes. |
void |
onPrepared()
Called when the wrapper has been prepared.
|
void |
prepare(com.google.android.exoplayer2.source.MediaPeriod.Callback callback,
long positionUs) |
long |
readDiscontinuity() |
void |
reevaluateBuffer(long positionUs) |
void |
release() |
long |
seekToUs(long positionUs) |
long |
selectTracks(com.google.android.exoplayer2.trackselection.TrackSelection[] selections,
boolean[] mayRetainStreamFlags,
com.google.android.exoplayer2.source.SampleStream[] streams,
boolean[] streamResetFlags,
long positionUs) |
public HlsMediaPeriod(HlsExtractorFactory extractorFactory, HlsPlaylistTracker playlistTracker, HlsDataSourceFactory dataSourceFactory, int minLoadableRetryCount, com.google.android.exoplayer2.source.MediaSourceEventListener.EventDispatcher eventDispatcher, com.google.android.exoplayer2.upstream.Allocator allocator, com.google.android.exoplayer2.source.CompositeSequenceableLoaderFactory compositeSequenceableLoaderFactory, boolean allowChunklessPreparation)
public void release()
public void prepare(com.google.android.exoplayer2.source.MediaPeriod.Callback callback,
long positionUs)
prepare in interface com.google.android.exoplayer2.source.MediaPeriodpublic void maybeThrowPrepareError()
throws java.io.IOException
maybeThrowPrepareError in interface com.google.android.exoplayer2.source.MediaPeriodjava.io.IOExceptionpublic com.google.android.exoplayer2.source.TrackGroupArray getTrackGroups()
getTrackGroups in interface com.google.android.exoplayer2.source.MediaPeriodpublic long selectTracks(com.google.android.exoplayer2.trackselection.TrackSelection[] selections,
boolean[] mayRetainStreamFlags,
com.google.android.exoplayer2.source.SampleStream[] streams,
boolean[] streamResetFlags,
long positionUs)
selectTracks in interface com.google.android.exoplayer2.source.MediaPeriodpublic void discardBuffer(long positionUs,
boolean toKeyframe)
discardBuffer in interface com.google.android.exoplayer2.source.MediaPeriodpublic void reevaluateBuffer(long positionUs)
reevaluateBuffer in interface com.google.android.exoplayer2.source.MediaPeriodreevaluateBuffer in interface com.google.android.exoplayer2.source.SequenceableLoaderpublic boolean continueLoading(long positionUs)
continueLoading in interface com.google.android.exoplayer2.source.MediaPeriodcontinueLoading in interface com.google.android.exoplayer2.source.SequenceableLoaderpublic long getNextLoadPositionUs()
getNextLoadPositionUs in interface com.google.android.exoplayer2.source.MediaPeriodgetNextLoadPositionUs in interface com.google.android.exoplayer2.source.SequenceableLoaderpublic long readDiscontinuity()
readDiscontinuity in interface com.google.android.exoplayer2.source.MediaPeriodpublic long getBufferedPositionUs()
getBufferedPositionUs in interface com.google.android.exoplayer2.source.MediaPeriodgetBufferedPositionUs in interface com.google.android.exoplayer2.source.SequenceableLoaderpublic long seekToUs(long positionUs)
seekToUs in interface com.google.android.exoplayer2.source.MediaPeriodpublic long getAdjustedSeekPositionUs(long positionUs,
com.google.android.exoplayer2.SeekParameters seekParameters)
getAdjustedSeekPositionUs in interface com.google.android.exoplayer2.source.MediaPeriodpublic void onPrepared()
com.google.android.exoplayer2.source.hls.HlsSampleStreamWrapper.CallbackonPrepared in interface com.google.android.exoplayer2.source.hls.HlsSampleStreamWrapper.Callbackpublic void onPlaylistRefreshRequired(HlsMasterPlaylist.HlsUrl url)
com.google.android.exoplayer2.source.hls.HlsSampleStreamWrapper.CallbackSequenceableLoader.continueLoading(long) call when the playlist referred by the
given url changes.onPlaylistRefreshRequired in interface com.google.android.exoplayer2.source.hls.HlsSampleStreamWrapper.Callbackpublic void onContinueLoadingRequested(com.google.android.exoplayer2.source.hls.HlsSampleStreamWrapper sampleStreamWrapper)
onContinueLoadingRequested in interface com.google.android.exoplayer2.source.SequenceableLoader.Callback<com.google.android.exoplayer2.source.hls.HlsSampleStreamWrapper>public void onPlaylistChanged()
HlsPlaylistTracker.PlaylistEventListeneronPlaylistChanged in interface HlsPlaylistTracker.PlaylistEventListenerpublic void onPlaylistBlacklisted(HlsMasterPlaylist.HlsUrl url, long blacklistMs)
HlsPlaylistTracker.PlaylistEventListeneronPlaylistBlacklisted in interface HlsPlaylistTracker.PlaylistEventListenerurl - The loaded url that caused the error.blacklistMs - The number of milliseconds for which the playlist has been
blacklisted.