Package com.castlabs.android.player

# Interface VideoRendererListener

All Known Implementing Classes:
  `AbstractVideoRendererListener`, `ExtendedTrackSelector`

public interface VideoRendererListener
A listener that can be attached to the `PlayerController` to be informed about video rendering events such as decoder initializations, format changes and frame drops. Note that all events are posted async on the main thread

Since:
  4.2.4

- ## Method Summary

  Modifier and Type
  Method
  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`
  `onVideoDecoderReleased(String decoderName, long releasedTimestampMs, long releaseDurationMs)`
  Called when a decoder is released.
  `void`
  `onVideoDisabled(com.google.android.exoplayer2.decoder.DecoderCounters counters)`
  Called when the renderer is disabled.
  `void`
  `onVideoEnabled(com.google.android.exoplayer2.decoder.DecoderCounters counters)`
  Called when the renderer is enabled.
  `void`
  `onVideoInputFormatChanged(com.google.android.exoplayer2.Format format)`
  Called when the format of the media being consumed by the renderer changes.

- ## Method Details

  - ### onVideoEnabled

    void onVideoEnabled(com.google.android.exoplayer2.decoder.DecoderCounters counters)
    Called when the renderer is enabled.
    Parameters:
      `counters` - `DecoderCounters` that will be updated by the renderer for as long as it remains enabled.

  - ### onVideoDecoderInitialized

    void onVideoDecoderInitialized(String decoderName, long initializedTimestampMs, long initializationDurationMs)
    Called when a decoder is created.
    Parameters:
      `decoderName` - The decoder that was created.
      `initializedTimestampMs` - `SystemClock.elapsedRealtime()` when initialization finished.
      `initializationDurationMs` - The time taken to initialize the decoder in milliseconds.

  - ### onVideoDecoderReleased

    void onVideoDecoderReleased(@NonNull String decoderName, long releasedTimestampMs, long releaseDurationMs)
    Called when a decoder is released.
    Parameters:
      `decoderName` - The decoder that was released.
      `releasedTimestampMs` - `SystemClock.elapsedRealtime()` when release finished.
      `releaseDurationMs` - The time taken to release the decoder in milliseconds.

  - ### onVideoInputFormatChanged

    void onVideoInputFormatChanged(com.google.android.exoplayer2.Format format)
    Called when the format of the media being consumed by the renderer changes.
    Parameters:
      `format` - The new format.

  - ### onDroppedFrames

    void onDroppedFrames(int count, long elapsedMs)
    Called to report the number of frames dropped by the renderer. Dropped frames are reported whenever the renderer is stopped having dropped frames, and optionally, whenever the count reaches a specified threshold whilst the renderer is started.
    Parameters:
      `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.

  - ### onRenderedFirstFrame

    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.
    Parameters:
      `surface` - The `Surface` to which a first frame has been rendered, or `null` if the renderer renders to something that isn't a `Surface`.

  - ### onVideoDisabled

    void onVideoDisabled(com.google.android.exoplayer2.decoder.DecoderCounters counters)
    Called when the renderer is disabled.
    Parameters:
      `counters` - `DecoderCounters` that were updated by the renderer.