# ActionSchedule.PlayerTarget

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

*** ** * ** ***


```
public abstract class ActionSchedule.PlayerTarget implements PlayerMessage.Target
```

<br />

*** ** * ** ***

Provides a wrapper for a `https://developer.android.com/reference/androidx/media3/exoplayer/PlayerMessage.Target` which has access to the player when handling messages. Can be used with `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#sendMessage(androidx.media3.exoplayer.PlayerMessage.Target,long)`.

The target can be passed to `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.Builder#waitForMessage(androidx.media3.test.utils.ActionSchedule.PlayerTarget)` to wait for a message to arrive at the target.

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.PlayerTarget.Callback` Callback to be called when message arrives. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.PlayerTarget#PlayerTarget()()` |

| ### Public methods |
|---|---|
| `final void` | `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.PlayerTarget#handleMessage(int,java.lang.Object)( @https://developer.android.com/reference/androidx/media3/exoplayer/Renderer.MessageType int messageType, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html message )` Handles a message delivered to the target. |
| `abstract void` | `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.PlayerTarget#handleMessage(androidx.media3.exoplayer.ExoPlayer,int,java.lang.Object)(https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlayer player, int messageType, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html message)` Handles the message send to the component and additionally provides access to the player. |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.PlayerTarget#setCallback(androidx.media3.test.utils.ActionSchedule.PlayerTarget.Callback)(https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.PlayerTarget.Callback callback)` |

## Public constructors

### PlayerTarget

```
public PlayerTarget()
```

## Public methods

### handleMessage

```
public final void handleMessage(
    @Renderer.MessageType int messageType,
    @Nullable Object message
)
```

Handles a message delivered to the target.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/media3/exoplayer/Renderer.MessageType int messageType` | The message type. |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html message` | The message payload. |

| Throws |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/ExoPlaybackException` | If an error occurred whilst handling the message. Should only be thrown by targets that handle messages on the playback thread. |

### handleMessage

```
public abstract void handleMessage(ExoPlayer player, int messageType, @Nullable Object message)
```

Handles the message send to the component and additionally provides access to the player.

### setCallback

```
public void setCallback(ActionSchedule.PlayerTarget.Callback callback)
```