# VideoGraph.Listener

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/common/VideoGraph.Listener "View this page in Java")

<br />

```
interface VideoGraph.Listener
```

<br />

*** ** * ** ***

Listener for video frame processing events.

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onEnded](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoGraph.Listener#onEnded(long))`(finalFramePresentationTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`)` Called after the[VideoGraph](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoGraph)has rendered its final output frame.                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onError](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoGraph.Listener#onError(androidx.media3.common.VideoFrameProcessingException))`(exception: `[VideoFrameProcessingException](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoFrameProcessingException)`!)` Called when an exception occurs during video frame processing.                                                                                                                         |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onOutputFrameAvailableForRendering](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoGraph.Listener#onOutputFrameAvailableForRendering(long,boolean))`(` ` framePresentationTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)`,` ` isRedrawnFrame: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) `)` Called when an output frame with the given`framePresentationTimeUs`becomes available for rendering. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onOutputFrameRateChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoGraph.Listener#onOutputFrameRateChanged(float))`(frameRate: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`)` Called when the output frame rate changes.                                                                                                                                                                                                                |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onOutputSizeChanged](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoGraph.Listener#onOutputSizeChanged(int,int))`(width: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, height: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called when the output size changes.                                                                                                                                               |

## Public functions

### onEnded

```
fun onEnded(finalFramePresentationTimeUs: Long): Unit
```

Called after the[VideoGraph](https://developer.android.com/reference/kotlin/androidx/media3/common/VideoGraph)has rendered its final output frame.  

|                                                  Parameters                                                   |
|---------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|
| `finalFramePresentationTimeUs: `[Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html) | The timestamp of the last output frame, in microseconds. |

### onError

```
fun onError(exception: VideoFrameProcessingException!): Unit
```

Called when an exception occurs during video frame processing.

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

### onOutputFrameAvailableForRendering

```
fun onOutputFrameAvailableForRendering(
    framePresentationTimeUs: Long,
    isRedrawnFrame: Boolean
): Unit
```

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

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

### onOutputFrameRateChanged

```
fun onOutputFrameRateChanged(frameRate: Float): Unit
```

Called when the output frame rate changes.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `frameRate: `[Float](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html) | The output frame rate in frames per second, or[NO_VALUE](https://developer.android.com/reference/kotlin/androidx/media3/common/Format#NO_VALUE())if unknown. |

### onOutputSizeChanged

```
fun onOutputSizeChanged(width: Int, height: Int): Unit
```

Called when the output size changes.  

|                                      Parameters                                       |
|---------------------------------------------------------------------------------------|---------------------------------|
| `width: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  | The new output width in pixels. |
| `height: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The new output width in pixels. |