Stay organized with collections Save and categorize content based on your preferences.

LeanbackPlayerAdapter

@UnstableApi
class LeanbackPlayerAdapter : PlayerAdapter, Runnable


Leanback PlayerAdapter implementation for Player.

Summary

Public constructors

LeanbackPlayerAdapter(
    context: Context!,
    player: Player!,
    updatePeriodMs: Int
)

Builds an instance.

Public constructors

LeanbackPlayerAdapter

LeanbackPlayerAdapter(
    context: Context!,
    player: Player!,
    updatePeriodMs: Int
)

Builds an instance. Note that the PlayerAdapter does not manage the lifecycle of the Player instance. The caller remains responsible for releasing the player when it's no longer required.

Parameters
context: Context!

The current Context (activity).

player: Player!

The Player being used.

updatePeriodMs: Int

The delay between player control updates, in milliseconds.

Public functions

getBufferedPosition

fun getBufferedPosition(): Long

getCurrentPosition

fun getCurrentPosition(): Long

getDuration

fun getDuration(): Long

isPlaying

fun isPlaying(): Boolean

isPrepared

fun isPrepared(): Boolean

onAttachedToHost

fun onAttachedToHost(host: PlaybackGlueHost!): Unit

onDetachedFromHost

fun onDetachedFromHost(): Unit

pause

fun pause(): Unit

play

fun play(): Unit

run

fun run(): Unit

seekTo

fun seekTo(positionMs: Long): Unit

setErrorMessageProvider

fun setErrorMessageProvider(
    errorMessageProvider: ErrorMessageProvider<Any!>?
): Unit

Sets the optional ErrorMessageProvider.

Parameters
errorMessageProvider: ErrorMessageProvider<Any!>?

The ErrorMessageProvider.

setProgressUpdatingEnabled

fun setProgressUpdatingEnabled(enabled: Boolean): Unit