public interface VideoRendererEventListener
Renderer
events.Modifier and Type | Interface and Description |
---|---|
static class |
VideoRendererEventListener.EventDispatcher
Dispatches events to a
VideoRendererEventListener . |
Modifier and Type | Method and Description |
---|---|
void |
onDroppedFrames(int count,
long elapsedMs)
Called to report the number of frames dropped by the renderer.
|
void |
onRenderedFirstFrame(Surface surface)
Called when a frame is rendered for the first time since setting the surface, and when a frame
is rendered for the first time since the renderer was reset.
|
void |
onVideoDecoderInitialized(String decoderName,
long initializedTimestampMs,
long initializationDurationMs)
Called when a decoder is created.
|
void |
onVideoDisabled(DecoderCounters counters)
Called when the renderer is disabled.
|
void |
onVideoEnabled(DecoderCounters counters)
Called when the renderer is enabled.
|
void |
onVideoInputFormatChanged(Format format)
Called when the format of the media being consumed by the renderer changes.
|
void |
onVideoSizeChanged(int width,
int height,
int unappliedRotationDegrees,
float pixelWidthHeightRatio)
Called each time there's a change in the size of the video being rendered.
|
void onVideoEnabled(DecoderCounters counters)
counters
- DecoderCounters
that will be updated by the renderer for as long as it
remains enabled.void onVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs)
decoderName
- The decoder that was created.initializedTimestampMs
- SystemClock.elapsedRealtime()
when initialization
finished.initializationDurationMs
- The time taken to initialize the decoder in milliseconds.void onVideoInputFormatChanged(Format format)
format
- The new format.void onDroppedFrames(int count, long elapsedMs)
count
- The number of dropped frames.elapsedMs
- The duration in milliseconds over which the frames were dropped. This
duration is timed from when the renderer was started or from when dropped frames were
last reported (whichever was more recent), and not from when the first of the reported
drops occurred.void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio)
width
- The video width in pixels.height
- The video height in pixels.unappliedRotationDegrees
- For videos that require a rotation, this is the clockwise
rotation in degrees that the application should apply for the video for it to be rendered
in the correct orientation. This value will always be zero on API levels 21 and above,
since the renderer will apply all necessary rotations internally. On earlier API levels
this is not possible. Applications that use TextureView
can apply the rotation by
calling TextureView.setTransform(android.graphics.Matrix)
. Applications that do not expect to encounter
rotated videos can safely ignore this parameter.pixelWidthHeightRatio
- The width to height ratio of each pixel. For the normal case
of square pixels this will be equal to 1.0. Different values are indicative of anamorphic
content.void onRenderedFirstFrame(Surface surface)
void onVideoDisabled(DecoderCounters counters)
counters
- DecoderCounters
that were updated by the renderer.