Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

PlayerCallback

open class PlayerCallback
kotlin.Any
   ↳ androidx.leanback.media.PlaybackGlueHost.PlayerCallback

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

Summary

Public constructors

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

Public methods

open Unit

notify media starts/stops buffering/preparing.

open Unit
onError(errorCode: Int, errorMessage: CharSequence!)

notify media has error.

open Unit
onVideoSizeChanged(videoWidth: Int, videoHeight: Int)

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

Public constructors

<init>

PlayerCallback()

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

Public methods

onBufferingStateChanged

open fun onBufferingStateChanged(start: Boolean): Unit

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

Parameters
start Boolean: True for buffering start, false otherwise.

onError

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

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

Parameters
errorCode Int: Optional error code for specific implementation.
errorMessage Int: Optional error message for specific implementation.

onVideoSizeChanged

open 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:
videoHeight Int: