PlaybackGlue
abstract class PlaybackGlue
kotlin.Any | |
↳ | androidx.leanback.media.PlaybackGlue |
Base class for abstraction of media play/pause feature. A subclass of PlaybackGlue will contain implementation of Media Player or a connection to playback Service. App initializes PlaybackGlue subclass, associated it with a PlaybackGlueHost
. PlaybackGlueHost
is typically implemented by a Fragment or an Activity, it provides the environment to render UI for PlaybackGlue object, it optionally provides SurfaceHolder via SurfaceHolderGlueHost
to render video. A typical PlaybackGlue should release resources (e.g. MediaPlayer or connection to playback Service) in onDetachedFromHost()
. onDetachedFromHost()
is called in two cases:
- app manually change it using
setHost(PlaybackGlueHost)
call - When host (fragment or activity) is destroyed
Summary
Nested classes | |
---|---|
abstract |
Interface to allow clients to take action once the video is ready to play and start stop. |
Public constructors | |
---|---|
Constructor. |
Public methods | |
---|---|
open Unit |
addPlayerCallback(playerCallback: PlaybackGlue.PlayerCallback!) Add a PlayerCallback. |
open Context! |
Returns the context. |
open PlaybackGlueHost! |
getHost() |
open Boolean |
Returns true if media is currently playing. |
open Boolean |
Returns true when the media player is prepared to start media playback. |
open Unit |
next() Goes to the next media item. |
open Unit |
pause() Pauses the media player. |
open Unit |
play() Starts the media player. |
open Unit |
Starts play when |
open Unit |
previous() Goes to the previous media item. |
open Unit |
removePlayerCallback(callback: PlaybackGlue.PlayerCallback!) Remove a PlayerCallback. |
Unit |
setHost(host: PlaybackGlueHost!) This method is used to associate a PlaybackGlue with the |
Protected methods | |
---|---|
open MutableList<PlaybackGlue.PlayerCallback!>! | |
open Unit |
onAttachedToHost(host: PlaybackGlueHost!) This method is called attached to associated |
open Unit |
This method is called when current associated |
open Unit |
This method is called when |
open Unit |
This method is called when |
open Unit |
This method is called when |
open Unit |
This method is called when |
Public constructors
Public methods
addPlayerCallback
open fun addPlayerCallback(playerCallback: PlaybackGlue.PlayerCallback!): Unit
Add a PlayerCallback.
Parameters | |
---|---|
playerCallback |
PlaybackGlue.PlayerCallback!: The callback to add. |
getContext
open fun