# VideoFrameProcessor.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/VideoFrameProcessor.java+class:androidx.media3.common.VideoFrameProcessor.Listener)

*** ** * ** ***


```
public interface VideoFrameProcessor.Listener
```

<br />

*** ** * ** ***

Listener for asynchronous frame processing events.

All listener methods must be called from the `https://developer.android.com/reference/java/util/concurrent/Executor.html` passed in at `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Factory#create(android.content.Context,androidx.media3.common.DebugViewProvider,androidx.media3.common.ColorInfo,boolean,java.util.concurrent.Executor,androidx.media3.common.VideoFrameProcessor.Listener)`.

## Summary

| ### Public methods |
|---|---|
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onEnded()()` Called after the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` has rendered its final output frame. |
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onError(androidx.media3.common.VideoFrameProcessingException)(https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessingException exception)` Called when an exception occurs during asynchronous video frame processing. |
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onInputStreamRegistered(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>)( @https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.InputType int inputType, https://developer.android.com/reference/androidx/media3/common/Format format, https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Effect> effects )` Called when the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` finishes `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)`. |
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameAvailableForRendering(long,boolean)( long presentationTimeUs, boolean isRedrawnFrame )` Called when an output frame with the given `presentationTimeUs` becomes available for rendering. |
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onOutputFrameRateChanged(float)(float frameRate)` Called when the output frame rate changes. |
| `default void` | `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.Listener#onOutputSizeChanged(int,int)(int width, int height)` Called when the output size changes. |

## Public methods

### onEnded

```
default void onEnded()
```

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

### onError

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

Called when an exception occurs during asynchronous video frame processing.

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

### onInputStreamRegistered

```
default void onInputStreamRegistered(
    @VideoFrameProcessor.InputType int inputType,
    Format format,
    List<Effect> effects
)
```

Called when the `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` finishes `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputStream(int,androidx.media3.common.Format,java.util.List<androidx.media3.common.Effect>,long)`.

The `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor` is now ready to accept new input `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#registerInputFrame()`, `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#queueInputBitmap(android.graphics.Bitmap,androidx.media3.common.util.TimestampIterator)` or `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#queueInputTexture(int,long)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.InputType int inputType` | The `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor.InputType` of the new input stream. |
| `https://developer.android.com/reference/androidx/media3/common/Format format` | The `https://developer.android.com/reference/androidx/media3/common/Format` of the new input stream. |
| `https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/media3/common/Effect> effects` | The list of `https://developer.android.com/reference/androidx/media3/common/Effect` to apply to the new input stream. |

### onOutputFrameAvailableForRendering

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

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

| Parameters |
|---|---|
| `long presentationTimeUs` | 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/VideoFrameProcessor#redraw()`, redrawn frames are rendered directly thus `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#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.

The output size is the frame size in pixels after applying all `https://developer.android.com/reference/androidx/media3/common/Effect`.

The output size may differ from the size specified using `https://developer.android.com/reference/androidx/media3/common/VideoFrameProcessor#setOutputSurfaceInfo(androidx.media3.common.SurfaceInfo)`.