# VideoGraph.Listener

Artifact: [androidx.media3:media3-common](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/common/VideoGraph.java+class:androidx.media3.common.VideoGraph.Listener)

*** ** * ** ***


```
public interface VideoGraph.Listener
```

<br />

*** ** * ** ***

Listener for video frame processing events.

## Summary

| ### Public methods |
|---|---|
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoGraph.Listener#onEnded(long)(long finalFramePresentationTimeUs)` Called after the `https://developer.android.com/reference/androidx/media3/common/VideoGraph` has rendered its final output frame. |
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoGraph.Listener#onError(androidx.media3.common.VideoFrameProcessingException)(https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException exception)` Called when an exception occurs during video frame processing. |
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoGraph.Listener#onOutputFrameAvailableForRendering(long,boolean)( long framePresentationTimeUs, boolean isRedrawnFrame )` Called when an output frame with the given `framePresentationTimeUs` becomes available for rendering. |
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoGraph.Listener#onOutputFrameRateChanged(float)(float frameRate)` Called when the output frame rate changes. |
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoGraph.Listener#onOutputSizeChanged(int,int)(int width, int height)` Called when the output size changes. |

## Public methods

### onEnded

```
default void onEnded(long finalFramePresentationTimeUs)
```

Called after the `https://developer.android.com/reference/androidx/media3/common/VideoGraph` has rendered its final output frame.

| Parameters |
|---|---|
| `long finalFramePresentationTimeUs` | The timestamp of the last output frame, in microseconds. |

### onError

```
default void onError(VideoFrameProcessingException exception)
```

Called when an exception occurs during video frame processing.

If this is called, the calling `https://developer.android.com/reference/androidx/media3/common/VideoGraph` must immediately be `https://developer.android.com/reference/androidx/media3/common/VideoGraph#release()`.

### onOutputFrameAvailableForRendering

```
default void onOutputFrameAvailableForRendering(
    long framePresentationTimeUs,
    boolean isRedrawnFrame
)
```

Called when an output frame with the given `framePresentationTimeUs` becomes available for rendering.

| Parameters |
|---|---|
| `long framePresentationTimeUs` | The presentation time of the frame, in microseconds. |
| `boolean isRedrawnFrame` | Whether the frame is a frame that is `https://developer.android.com/reference/androidx/media3/common/VideoGraph#redraw()`, redrawn frames are rendered directly thus `https://developer.android.com/reference/androidx/media3/common/VideoGraph#renderOutputFrame(long)` must not be called on such frames. |

### onOutputFrameRateChanged

```
default void onOutputFrameRateChanged(float frameRate)
```

Called when the output frame rate changes.

| Parameters |
|---|---|
| `float frameRate` | The output frame rate in frames per second, or `https://developer.android.com/reference/androidx/media3/common/Format#NO_VALUE()` if unknown. |

### onOutputSizeChanged

```
default void onOutputSizeChanged(int width, int height)
```

Called when the output size changes.

| Parameters |
|---|---|
| `int width` | The new output width in pixels. |
| `int height` | The new output width in pixels. |