public final class DummyTrackRenderer extends TrackRenderer
TrackRenderer that does nothing.
This renderer returns 0 from getTrackCount() in order to request that it should be
ignored. IllegalStateException is thrown from all other methods documented to indicate
that they should not be invoked unless the renderer is prepared.
END_OF_TRACK_US, MATCH_LONGEST_US, STATE_ENABLED, STATE_PREPARED, STATE_RELEASED, STATE_STARTED, STATE_UNPREPARED, UNKNOWN_TIME_US| Constructor and Description |
|---|
DummyTrackRenderer() |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
doPrepare(long positionUs)
Invoked to make progress when the renderer is in the
TrackRenderer.STATE_UNPREPARED state. |
protected void |
doSomeWork(long positionUs,
long elapsedRealtimeUs)
Invoked to make progress when the renderer is in the
TrackRenderer.STATE_ENABLED or
TrackRenderer.STATE_STARTED states. |
protected long |
getBufferedPositionUs()
Returns an estimate of the absolute position in microseconds up to which data is buffered.
|
protected long |
getDurationUs()
Returns the duration of the media being rendered.
|
protected MediaFormat |
getFormat(int track)
Returns the format of the specified track.
|
protected int |
getTrackCount()
Returns the number of tracks exposed by the renderer.
|
protected boolean |
isEnded()
Whether the renderer is ready for the
ExoPlayer instance to transition to
ExoPlayer.STATE_ENDED. |
protected boolean |
isReady()
Whether the renderer is able to immediately render media from the current position.
|
protected void |
maybeThrowError()
Throws an error that's preventing the renderer from making progress or buffering more data at
this point in time.
|
protected void |
seekTo(long positionUs)
Seeks to a specified time in the track.
|
getMediaClock, getState, handleMessage, onDisabled, onEnabled, onReleased, onStarted, onStoppedprotected boolean doPrepare(long positionUs)
throws ExoPlaybackException
TrackRendererTrackRenderer.STATE_UNPREPARED state. This
method will be called repeatedly until true is returned.
This method should return quickly, and should not block if the renderer is currently unable to make any useful progress.
doPrepare in class TrackRendererpositionUs - The player's current playback position.ExoPlaybackException - If an error occurs.protected int getTrackCount()
TrackRenderer
This method may be called when the renderer is in the following states:
TrackRenderer.STATE_PREPARED, TrackRenderer.STATE_ENABLED, TrackRenderer.STATE_STARTED
getTrackCount in class TrackRendererprotected MediaFormat getFormat(int track)
TrackRenderer
This method may be called when the renderer is in the following states:
TrackRenderer.STATE_PREPARED, TrackRenderer.STATE_ENABLED, TrackRenderer.STATE_STARTED
getFormat in class TrackRenderertrack - The track index.protected boolean isEnded()
TrackRendererExoPlayer instance to transition to
ExoPlayer.STATE_ENDED. The player will make this transition as soon as true is
returned by all of its TrackRenderers.
This method may be called when the renderer is in the following states:
TrackRenderer.STATE_ENABLED, TrackRenderer.STATE_STARTED
isEnded in class TrackRendererprotected boolean isReady()
TrackRenderer
If the renderer is in the TrackRenderer.STATE_STARTED state then returning true indicates that the
renderer has everything that it needs to continue playback. Returning false indicates that
the player should pause until the renderer is ready.
If the renderer is in the TrackRenderer.STATE_ENABLED state then returning true indicates that the
renderer is ready for playback to be started. Returning false indicates that it is not.
This method may be called when the renderer is in the following states:
TrackRenderer.STATE_ENABLED, TrackRenderer.STATE_STARTED
isReady in class TrackRendererprotected void seekTo(long positionUs)
TrackRenderer
This method may be called when the renderer is in the following states:
TrackRenderer.STATE_ENABLED
seekTo in class TrackRendererpositionUs - The desired playback position in microseconds.protected void doSomeWork(long positionUs,
long elapsedRealtimeUs)
TrackRendererTrackRenderer.STATE_ENABLED or
TrackRenderer.STATE_STARTED states.
If the renderer's state is TrackRenderer.STATE_STARTED, then repeated calls to this method should
cause the media track to be rendered. If the state is TrackRenderer.STATE_ENABLED, then repeated
calls should make progress towards getting the renderer into a position where it is ready to
render the track.
This method should return quickly, and should not block if the renderer is currently unable to make any useful progress.
This method may be called when the renderer is in the following states:
TrackRenderer.STATE_ENABLED, TrackRenderer.STATE_STARTED
doSomeWork in class TrackRendererpositionUs - The current media time in microseconds, measured at the start of the
current iteration of the rendering loop.elapsedRealtimeUs - SystemClock.elapsedRealtime() in microseconds,
measured at the start of the current iteration of the rendering loop.protected void maybeThrowError()
TrackRenderermaybeThrowError in class TrackRendererprotected long getDurationUs()
TrackRenderer
This method may be called when the renderer is in the following states:
TrackRenderer.STATE_PREPARED, TrackRenderer.STATE_ENABLED, TrackRenderer.STATE_STARTED
getDurationUs in class TrackRendererTrackRenderer.MATCH_LONGEST_US if
the track's duration should match that of the longest track whose duration is known, or
or TrackRenderer.UNKNOWN_TIME_US if the duration is not known.protected long getBufferedPositionUs()
TrackRenderer
This method may be called when the renderer is in the following states:
TrackRenderer.STATE_ENABLED, TrackRenderer.STATE_STARTED
getBufferedPositionUs in class TrackRendererTrackRenderer.END_OF_TRACK_US if the track is fully buffered, or TrackRenderer.UNKNOWN_TIME_US if
no estimate is available.