# PlaybackGlueHost.PlayerCallback

# PlaybackGlueHost.PlayerCallback

Artifact:[androidx.leanback:leanback](https://developer.android.com/jetpack/androidx/releases/leanback)  
[View Source](https://cs.android.com/search?q=file:androidx/leanback/media/PlaybackGlueHost.java+class:androidx.leanback.media.PlaybackGlueHost.PlayerCallback)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/leanback/media/PlaybackGlueHost.PlayerCallback "View this page in Java")

<br />

```
class PlaybackGlueHost.PlayerCallback
```

<br />

*** ** * ** ***

Optional Client that implemented by PlaybackGlueHost to respond to player event.

## Summary

|                                                            ### Public constructors                                                            |
|-----------------------------------------------------------------------------------------------------------------------------------------------|
| [PlayerCallback](https://developer.android.com/reference/kotlin/androidx/leanback/media/PlaybackGlueHost.PlayerCallback#PlayerCallback())`()` |

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onBufferingStateChanged](https://developer.android.com/reference/kotlin/androidx/leanback/media/PlaybackGlueHost.PlayerCallback#onBufferingStateChanged(boolean))`(start: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`)` notify media starts/stops buffering/preparing.                                                                                                                          |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onError](https://developer.android.com/reference/kotlin/androidx/leanback/media/PlaybackGlueHost.PlayerCallback#onError(int,java.lang.CharSequence))`(errorCode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, errorMessage: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`!)` notify media has error.                                                 |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onVideoSizeChanged](https://developer.android.com/reference/kotlin/androidx/leanback/media/PlaybackGlueHost.PlayerCallback#onVideoSizeChanged(int,int))`(videoWidth: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, videoHeight: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Size of the video changes, the Host should adjust SurfaceView's layout width and height. |

## Public constructors

### PlayerCallback

Added in 1.1.0  

```
PlayerCallback()
```  

## Public functions

### onBufferingStateChanged

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
fun onBufferingStateChanged(start: Boolean): Unit
```

notify media starts/stops buffering/preparing. The Host could start or stop progress bar.  

|                                          Parameters                                          |
|----------------------------------------------------------------------------------------------|--------------------------------------------|
| `start: `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | True for buffering start, false otherwise. |

### onError

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
fun onError(errorCode: Int, errorMessage: CharSequence!): Unit
```

notify media has error. The Host could show error dialog.  

|                                                    Parameters                                                     |
|-------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| `errorCode: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                          | Optional error code for specific implementation.    |
| `errorMessage: `[CharSequence](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html)`!` | Optional error message for specific implementation. |

### onVideoSizeChanged

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)  

```
fun onVideoSizeChanged(videoWidth: Int, videoHeight: Int): Unit
```

Size of the video changes, the Host should adjust SurfaceView's layout width and height.  

|                                         Parameters                                         |
|--------------------------------------------------------------------------------------------|---|
| `videoWidth: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)  |   |
| `videoHeight: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) |   |