# ActionSchedule.PlayerTarget

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/media3/test/utils/ActionSchedule.PlayerTarget "View this page in Java")

<br />

```
abstract class ActionSchedule.PlayerTarget : PlayerMessage.Target
```

<br />

*** ** * ** ***

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

The target can be passed to[waitForMessage](https://developer.android.com/reference/kotlin/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                                                                                                |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `interface `[ActionSchedule.PlayerTarget.Callback](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ActionSchedule.PlayerTarget.Callback) Callback to be called when message arrives. |

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

|                                   ### Public functions                                   |
|------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)            | [handleMessage](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ActionSchedule.PlayerTarget#handleMessage(int,java.lang.Object))`(@`[Renderer.MessageType](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/Renderer.MessageType)` messageType: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, message: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` Handles a message delivered to the target.                                                                       |
| `abstract `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [handleMessage](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ActionSchedule.PlayerTarget#handleMessage(androidx.media3.exoplayer.ExoPlayer,int,java.lang.Object))`(player: `[ExoPlayer](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/ExoPlayer)`!, messageType: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, message: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` Handles the message send to the component and additionally provides access to the player. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)            | [setCallback](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ActionSchedule.PlayerTarget#setCallback(androidx.media3.test.utils.ActionSchedule.PlayerTarget.Callback))`(callback: `[ActionSchedule.PlayerTarget.Callback](https://developer.android.com/reference/kotlin/androidx/media3/test/utils/ActionSchedule.PlayerTarget.Callback)`!)`                                                                                                                                                                                                                    |

## Public constructors

### PlayerTarget

```
PlayerTarget()
```  

## Public functions

### handleMessage

```
fun handleMessage(@Renderer.MessageType messageType: Int, message: Any?): Unit
```

Handles a message delivered to the target.  

|                                                                                                     Parameters                                                                                                      |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------|
| `@`[Renderer.MessageType](https://developer.android.com/reference/kotlin/androidx/media3/exoplayer/Renderer.MessageType)` messageType: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The message type.    |
| `message: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?`                                                                                                                           | The message payload. |

|                                                                     Throws                                                                      |
|-------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------|
| [androidx.media3.exoplayer.ExoPlaybackException](https://developer.android.com/reference/kotlin/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

```
abstract fun handleMessage(player: ExoPlayer!, messageType: Int, message: Any?): Unit
```

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

### setCallback

```
fun setCallback(callback: ActionSchedule.PlayerTarget.Callback!): Unit
```