PlaybackGlueHost

abstract class PlaybackGlueHost
kotlin.Any
   ↳ androidx.leanback.media.PlaybackGlueHost

This class represents the UI (e.g. Fragment/Activity) hosting playback controls and defines the interaction between PlaybackGlue and the host. PlaybackGlueHost provides the following functions:

  • Render UI of PlaybackGlue: setPlaybackRow(Row), setPlaybackRowPresenter(PlaybackRowPresenter).
  • Client for fragment/activity onStart/onStop: setHostCallback(HostCallback).
  • Auto fade out controls after a short period: setFadingEnabled(boolean).
  • Key listener and ActionListener. setOnKeyInterceptListener(View.OnKeyListener), setOnActionClickedListener(OnActionClickedListener).
  • Subclass of PlaybackGlueHost may implement optional interfaces:
  • SurfaceHolderGlueHost to provide SurfaceView for video playback.
  • PlaybackSeekUi to provide seek UI to glue
  • These optional interfaces should be accessed by glue in PlaybackGlue#onAttachedToHost(PlaybackGlueHost).

    Summary

    Nested classes

    abstract

    Callbacks triggered by the host(e.g. fragment) hosting the video controls/surface.

    open

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

    Public constructors

    This class represents the UI (e.g. Fragment/Activity) hosting playback controls and defines the interaction between

    Public methods

    open Unit

    Fades out the playback overlay immediately.

    open PlaybackGlueHost.PlayerCallback!

    Implemented by PlaybackGlueHost for responding to player events.

    open Unit

    Hide controls overlay.

    open Boolean

    Returns true if auto hides controls overlay.

    open Boolean

    Returns true if controls overlay is visible, false otherwise.

    open Unit

    Notifies host about a change so it can update the view.

    open Unit

    Enables or disables controls overlay auto hidden.

    open Unit

    Enables or disables view fading.

    open Unit

    Sets the host HostCallback callback on the host.

    open Unit

    Sets the View.OnClickListener on this fragment.

    open Unit

    Sets the android.view.View.OnKeyListener on the host.

    open Unit

    Sets the Row that represents the information on control items that needs to be rendered.

    open Unit

    Sets PlaybackRowPresenter for rendering the playback controls.

    open Unit

    Show controls overlay.

    Public constructors

    <init>

    PlaybackGlueHost()

    This class represents the UI (e.g. Fragment/Activity) hosting playback controls and defines the interaction between PlaybackGlue and the host. PlaybackGlueHost provides the following functions:

  • Render UI of PlaybackGlue: setPlaybackRow(Row), setPlaybackRowPresenter(PlaybackRowPresenter).
  • Client for fragment/activity onStart/onStop: setHostCallback(HostCallback).
  • Auto fade out controls after a short period: setFadingEnabled(boolean).
  • Key listener and ActionListener. setOnKeyInterceptListener(View.OnKeyListener), setOnActionClickedListener(OnActionClickedListener).
  • Subclass of PlaybackGlueHost may implement optional interfaces:
  • SurfaceHolderGlueHost to provide SurfaceView for video playback.
  • PlaybackSeekUi to provide seek UI to glue
  • These optional interfaces should be accessed by glue in PlaybackGlue#onAttachedToHost(PlaybackGlueHost).

    Public methods

    fadeOut

    open fun fadeOut(): Unit

    Deprecated: Call hideControlsOverlay(boolean)

    Fades out the playback overlay immediately.

    getPlayerCallback

    open fun getPlayerCallback(): PlaybackGlueHost.PlayerCallback!

    Implemented by PlaybackGlueHost for responding to player events. Such as showing a spinning wheel progress bar when PlayerCallback#onBufferingStateChanged(boolean).

    Return
    PlaybackGlueHost.PlayerCallback!: PlayerEventCallback that Host supports, null if not supported.

    hideControlsOverlay

    open fun hideControlsOverlay(runAnimation: Boolean): Unit

    Hide controls overlay.

    Parameters
    runAnimation Boolean: True to run animation, false otherwise.

    isControlsOverlayAutoHideEnabled

    open fun isControlsOverlayAutoHideEnabled(): Boolean

    Returns true if auto hides controls overlay.

    Return
    Boolean: True if auto hiding controls overlay.

    isControlsOverlayVisible

    open fun isControlsOverlayVisible(): Boolean

    Returns true if controls overlay is visible, false otherwise.

    Return
    Boolean: True if controls overlay is visible, false otherwise.

    notifyPlaybackRowChanged

    open fun notifyPlaybackRowChanged(): Unit

    Notifies host about a change so it can update the view.

    setControlsOverlayAutoHideEnabled

    open fun setControlsOverlayAutoHideEnabled(enabled: Boolean): Unit

    Enables or disables controls overlay auto hidden. If enabled, the view will be faded out after a time period.

    Parameters
    enabled Boolean: True to enable auto hidden of controls overlay.

    setFadingEnabled

    open fun setFadingEnabled(enable: Boolean): Unit

    Deprecated: Use setControlsOverlayAutoHideEnabled(boolean)

    Enables or disables view fading. If enabled, the view will be faded in when the fragment starts and will fade out after a time period.

    setHostCallback

    open fun setHostCallback(callback: PlaybackGlueHost.HostCallback!): Unit

    Sets the host HostCallback callback on the host. This method should only be called by PlaybackGlue. App should not directly call this method, app should override PlaybackGlue#onHostStart() etc.

    setOnActionClickedListener

    open fun setOnActionClickedListener(listener: OnActionClickedListener!): Unit

    Sets the View.OnClickListener on this fragment.

    setOnKeyInterceptListener

    open fun setOnKeyInterceptListener(onKeyListener: OnKeyListener!): Unit

    Sets the android.view.View.OnKeyListener on the host. This would trigger the listener when a android.view.KeyEvent is unhandled by the host.

    setPlaybackRow

    open fun setPlaybackRow(row: Row!): Unit

    Sets the Row that represents the information on control items that needs to be rendered.

    setPlaybackRowPresenter

    open fun setPlaybackRowPresenter(presenter: PlaybackRowPresenter!): Unit

    Sets PlaybackRowPresenter for rendering the playback controls.

    showControlsOverlay

    open fun showControlsOverlay(runAnimation: Boolean): Unit

    Show controls overlay.

    Parameters
    runAnimation Boolean: True to run animation, false otherwise.