Interface VideoRendererEventListener


  • @Deprecated
    public interface VideoRendererEventListener
    Deprecated.
    com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
    Listener of video Renderer events. All methods have no-op default implementations to allow selective overrides.
    • Method Detail

      • onVideoEnabled

        default void onVideoEnabled​(DecoderCounters counters)
        Deprecated.
        Called when the renderer is enabled.
        Parameters:
        counters - DecoderCounters that will be updated by the renderer for as long as it remains enabled.
      • onVideoDecoderInitialized

        default void onVideoDecoderInitialized​(String decoderName,
                                               long initializedTimestampMs,
                                               long initializationDurationMs)
        Deprecated.
        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.
      • onVideoInputFormatChanged

        default void onVideoInputFormatChanged​(Format format,
                                               @Nullable
                                               DecoderReuseEvaluation decoderReuseEvaluation)
        Deprecated.
        Called when the format of the media being consumed by the renderer changes.
        Parameters:
        format - The new format.
        decoderReuseEvaluation - The result of the evaluation to determine whether an existing decoder instance can be reused for the new format, or null if the renderer did not have a decoder.
      • onDroppedFrames

        default void onDroppedFrames​(int count,
                                     long elapsedMs)
        Deprecated.
        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.
      • onVideoFrameProcessingOffset

        default void onVideoFrameProcessingOffset​(long totalProcessingOffsetUs,
                                                  int frameCount)
        Deprecated.
        Called to report the video processing offset of video frames processed by the video renderer.

        Video processing offset represents how early a video frame is processed compared to the player's current position. For each video frame, the offset is calculated as Pvf - Ppl where Pvf is the presentation timestamp of the video frame and Ppl is the current position of the player. Positive values indicate the frame was processed early enough whereas negative values indicate that the player's position had progressed beyond the frame's timestamp when the frame was processed (and the frame was probably dropped).

        The renderer reports the sum of video processing offset samples (one sample per processed video frame: dropped, skipped or rendered) and the total number of samples.

        Parameters:
        totalProcessingOffsetUs - The sum of all video frame processing offset samples for the video frames processed by the renderer in microseconds.
        frameCount - The number of samples included in the totalProcessingOffsetUs.
      • onVideoSizeChanged

        default void onVideoSizeChanged​(VideoSize videoSize)
        Deprecated.
        Called before a frame is rendered for the first time since setting the surface, and each time there's a change in the size, rotation or pixel aspect ratio of the video being rendered.
        Parameters:
        videoSize - The new size of the video.
      • onRenderedFirstFrame

        default void onRenderedFirstFrame​(Object output,
                                          long renderTimeMs)
        Deprecated.
        Called when a frame is rendered for the first time since setting the output, or since the renderer was reset, or since the stream being rendered was changed.
        Parameters:
        output - The output of the video renderer. Normally a Surface, however some video renderers may have other output types (e.g., a VideoDecoderOutputBufferRenderer).
        renderTimeMs - The SystemClock.elapsedRealtime() when the frame was rendered.
      • onVideoDecoderReleased

        default void onVideoDecoderReleased​(String decoderName)
        Deprecated.
        Called when a decoder is released.
        Parameters:
        decoderName - The decoder that was released.
      • onVideoDisabled

        default void onVideoDisabled​(DecoderCounters counters)
        Deprecated.
        Called when the renderer is disabled.
        Parameters:
        counters - DecoderCounters that were updated by the renderer.
      • onVideoCodecError

        default void onVideoCodecError​(Exception videoCodecError)
        Deprecated.
        Called when a video decoder encounters an error.

        This method being called does not indicate that playback has failed, or that it will fail. The player may be able to recover from the error. Hence applications should not implement this method to display a user visible error or initiate an application level retry. Player.Listener.onPlayerError(com.google.android.exoplayer2.PlaybackException) is the appropriate place to implement such behavior. This method is called to provide the application with an opportunity to log the error if it wishes to do so.

        Parameters:
        videoCodecError - The error. Typically a MediaCodec.CodecException if the renderer uses MediaCodec, or a DecoderException if the renderer uses a software decoder.