PlaybackBannerControlGlue
open class PlaybackBannerControlGlue<T : PlayerAdapter!> : PlaybackBaseControlGlue<T>
kotlin.Any | |||
↳ | androidx.leanback.media.PlaybackGlue | ||
↳ | androidx.leanback.media.PlaybackBaseControlGlue<T> | ||
↳ | androidx.leanback.media.PlaybackBannerControlGlue |
A helper class for managing a PlaybackControlsRow
being displayed in PlaybackGlueHost
. It supports standard playback control actions play/pause and skip next/previous. This helper class is a glue layer that manages interaction between the leanback UI components PlaybackControlsRow
PlaybackControlsRowPresenter
and a functional PlayerAdapter
which represents the underlying media player.
Apps must pass a PlayerAdapter
in the constructor for a specific implementation e.g. a MediaPlayerAdapter
.
The glue has two action bars: primary action bars and secondary action bars. Apps can provide additional actions by overriding onCreatePrimaryActions
and / or onCreateSecondaryActions
and respond to actions by overriding #onActionClicked(Action).
The subclass is responsible for implementing the "repeat mode" in onPlayCompleted()
.
<code> public class MyVideoFragment extends VideoFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); PlaybackBannerControlGlue <mediaplayeradapter> playerGlue = new PlaybackBannerControlGlue(getActivity(), new MediaPlayerAdapter(getActivity())); playerGlue.setHost(new VideoFragmentGlueHost(this)); playerGlue.setSubtitle("Leanback artist"); playerGlue.setTitle("Leanback team at work"); String uriPath = "android.resource://com.example.android.leanback/raw/video"; playerGlue.getPlayerAdapter().setDataSource(Uri.parse(uriPath)); playerGlue.playWhenPrepared(); } } </mediaplayeradapter></code>
Summary
Constants | |
---|---|
static Int |
The adapter key for the first custom control on the left side of the predefined primary controls. |
static Int |
The adapter key for the first custom control on the right side of the predefined primary controls. |
static Int |
The adapter key for the fast forward control. |
static Int |
The adapter key for the play/pause control. |
static Int |
The adapter key for the rewind control. |
static Int |
The adapter key for the skip to next control. |
static Int |
The adapter key for the skip to previous control. |
static Int |
The initial (level 0) fast forward playback speed. |
static Int |
The level 1 fast forward playback speed. |
static Int |
The level 2 fast forward playback speed. |
static Int |
The level 3 fast forward playback speed. |
static Int |
The level 4 fast forward playback speed. |
static Int |
Invalid playback speed. |
static Int |
Speed representing playback state that is playing normally. |
static Int |
Speed representing playback state that is paused. |
Inherited constants | |
---|---|
Public constructors | |
---|---|
Constructor for the glue. |
|
Constructor for the glue. |
Public methods | |
---|---|
open Long |
Gets current position of the player. |
open IntArray |
Returns the fast forward speeds. |
open IntArray |
Returns the rewind speeds. |
open Unit |
onActionClicked(action: Action!) Handles action clicks. |
open Boolean |
Handles key events and returns true if handled. |
open Unit |
pause() |
open Unit |
play() |
open Unit |
setControlsRow(controlsRow: PlaybackControlsRow!) |
Protected methods | |
---|---|
open Unit |
|