FakeRenderer
@UnstableApi
public class FakeRenderer extends BaseRenderer
FakeAudioRenderer |
A |
FakeMediaClockRenderer |
Fake abstract |
FakeVideoRenderer |
A |
Fake Renderer that supports any format with the matching track type.
The renderer verifies that all the formats it reads have the provided track type.
Summary
Public constructors |
|---|
FakeRenderer(@C.TrackType int trackType) |
Public methods |
|
|---|---|
List<Format> |
Returns the list of formats read by the renderer. |
String |
getName()Returns the name of this renderer, for logging and debugging purposes. |
boolean |
isEnded()Whether the renderer is ready for the |
boolean |
isReady()Whether the renderer is able to immediately render media from the current position. |
void |
render(long positionUs, long elapsedRealtimeUs)Incrementally renders the |
int |
Returns the extent to which the |
Protected methods |
|
|---|---|
void |
Called when the renderer is disabled. |
void |
onEnabled(boolean joining, boolean mayRenderStartOfStream)Called when the renderer is enabled. |
void |
onFormatChanged(Format format)Called when the renderer reads a new format. |
void |
onInit()Called when the renderer is initialized. |
void |
onPositionReset(Called when the position is reset. |
void |
Called when the renderer is released. |
void |
onReset()Called when the renderer is reset. |
boolean |
shouldProcessBuffer(long bufferTimeUs, long playbackPositionUs)Called before the renderer processes a buffer. |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Inherited fields |
||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Inherited methods |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public fields
Public constructors
Public methods
getFormatsRead
public List<Format> getFormatsRead()
Returns the list of formats read by the renderer.
getName
public String getName()
Returns the name of this renderer, for logging and debugging purposes. Should typically be the renderer's (un-obfuscated) class name.
| Returns | |
|---|---|
String |
The name of this renderer. |
isEnded
public boolean isEnded()
Whether the renderer is ready for the ExoPlayer instance to transition to STATE_ENDED. The player will make this transition as soon as true is returned by all of its renderers.
This method may be called when the renderer is in the following states: STATE_ENABLED, STATE_STARTED.
| Returns | |
|---|---|
boolean |
Whether the renderer is ready for the player to transition to the ended state. |
isReady
public boolean isReady()
Whether the renderer is able to immediately render media from the current position.
If the renderer is in the 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 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: STATE_ENABLED, STATE_STARTED.
| Returns | |
|---|---|
boolean |
Whether the renderer is ready to render media. |
render
public void render(long positionUs, long elapsedRealtimeUs)
Incrementally renders the SampleStream.
If the renderer is in the STATE_ENABLED state then each call to this method will do work toward being ready to render the SampleStream when the renderer is started. If the renderer is in the STATE_STARTED state then calls to this method will render the SampleStream in sync with the specified media positions.
The renderer may also render the very start of the media at the current position (e.g. the first frame of a video stream) while still in the STATE_ENABLED state, unless it's the initial start of the media after calling enable with
mayRenderStartOfStream set to false.
This method should return quickly, and should not block if the renderer is unable to make useful progress.
This method may be called when the renderer is in the following states: STATE_ENABLED, STATE_STARTED.
| Parameters | |
|---|---|
long positionUs |
The current media time in microseconds, measured at the start of the current iteration of the rendering loop. |
long elapsedRealtimeUs |
|
| Throws | |
|---|---|
androidx.media3.exoplayer.ExoPlaybackException |
If an error occurs. |
supportsFormat
@RendererCapabilities.Capabilities
public int supportsFormat(Format format)
Returns the extent to which the Renderer supports a given format.
| Parameters | |
|---|---|
Format format |
The format. |
| Returns | |
|---|---|
int |
The |
| Throws | |
|---|---|
androidx.media3.exoplayer.ExoPlaybackException |
If an error occurs. |
Protected methods
onDisabled
protected void onDisabled()
Called when the renderer is disabled.
The default implementation is a no-op.
onEnabled
protected void onEnabled(boolean joining, boolean mayRenderStartOfStream)
Called when the renderer is enabled.
The default implementation is a no-op.
| Parameters | |
|---|---|
boolean joining |
Whether this renderer is being enabled to join an ongoing playback. |
boolean mayRenderStartOfStream |
Whether this renderer is allowed to render the start of the stream even if the state is not |
| Throws | |
|---|---|
androidx.media3.exoplayer.ExoPlaybackException |
If an error occurs. |
onFormatChanged
protected void onFormatChanged(Format format)
Called when the renderer reads a new format.
onPositionReset
protected void onPositionReset(
long positionUs,
boolean joining,
boolean sampleStreamIsResetToKeyFrame
)
Called when the position is reset. This occurs when the renderer is enabled after onStreamChanged has been called, and also when a position discontinuity is encountered.
After a position reset, the renderer's SampleStream is guaranteed to provide samples starting from a key frame if sampleStreamIsResetToKeyFrame is true.
sampleStreamIsResetToKeyFrame is guaranteed to be true unless the implementation overrides supportsResetPositionWithoutKeyFrameReset to return
true.
The default implementation is a no-op.
| Parameters | |
|---|---|
long positionUs |
The new playback position in microseconds. |
boolean joining |
Whether this renderer is being enabled to join an ongoing playback. |
boolean sampleStreamIsResetToKeyFrame |
Whether the renderer's |
| Throws | |
|---|---|
androidx.media3.exoplayer.ExoPlaybackException |
If an error occurs. |
onRelease
protected void onRelease()
Called when the renderer is released.
The default implementation is a no-op.
onReset
protected void onReset()
Called when the renderer is reset.
The default implementation is a no-op.
shouldProcessBuffer
protected boolean shouldProcessBuffer(long bufferTimeUs, long playbackPositionUs)
Called before the renderer processes a buffer.
| Parameters | |
|---|---|
long bufferTimeUs |
The buffer timestamp, in microseconds. |
long playbackPositionUs |
The playback position, in microseconds |
| Returns | |
|---|---|
boolean |
Whether the buffer should be processed. |