FakeVideoRenderer
@UnstableApi
public class FakeVideoRenderer extends FakeRenderer
| java.lang.Object | |||
| ↳ | androidx.media3.exoplayer.BaseRenderer | ||
| ↳ | androidx.media3.test.utils.FakeRenderer | ||
| ↳ | androidx.media3.test.utils.FakeVideoRenderer |
A FakeRenderer that supports TRACK_TYPE_VIDEO.
Summary
Public constructors |
|---|
FakeVideoRenderer( |
Public methods |
|
|---|---|
void |
handleMessage(Handles a message delivered to the target. |
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 |
onPositionReset(Called when the position is reset. |
void |
Called when the renderer is stopped. |
void |
onStreamChanged(Called when the renderer's stream has changed. |
boolean |
shouldProcessBuffer(long bufferTimeUs, long playbackPositionUs)Called before the renderer processes a buffer. |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Inherited fields |
||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||
Inherited methods |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Public constructors
FakeVideoRenderer
public FakeVideoRenderer(
HandlerWrapper handler,
VideoRendererEventListener eventListener
)
Public methods
handleMessage
public void handleMessage(
@Renderer.MessageType int messageType,
@Nullable Object message
)
Handles a message delivered to the target.
| Parameters | |
|---|---|
@Renderer.MessageType int messageType |
The message type. |
@Nullable Object message |
The message payload. |
| Throws | |
|---|---|
androidx.media3.exoplayer.ExoPlaybackException |
If an error occurred whilst handling the message. Should only be thrown by targets that handle messages on the playback thread. |
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. |
onStopped
protected void onStopped()
Called when the renderer is stopped.
The default implementation is a no-op.
onStreamChanged
protected void onStreamChanged(
Format[] formats,
long startPositionUs,
long offsetUs,
MediaSource.MediaPeriodId mediaPeriodId
)
Called when the renderer's stream has changed. This occurs when the renderer is enabled after onEnabled has been called, and also when the stream has been replaced whilst the renderer is enabled or started.
The default implementation is a no-op.
| Parameters | |
|---|---|
Format[] formats |
The enabled formats. |
long startPositionUs |
The start position of the new stream in renderer time (microseconds). |
long offsetUs |
The offset that will be added to the timestamps of buffers read via |
MediaSource.MediaPeriodId mediaPeriodId |
The |
| Throws | |
|---|---|
androidx.media3.exoplayer.ExoPlaybackException |
If an error occurs. |
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. |