Client

open class Client
kotlin.Any
   ↳ androidx.leanback.widget.PlaybackSeekUi.Client

Client (e.g. PlaybackGlue) to register on PlaybackSeekUi so that it can interact with Seeking UI. For example client(PlaybackGlue) will pause media when PlaybackSeekUi emits onSeekStarted() event.

Summary

Public constructors

Client (e.g. PlaybackGlue) to register on PlaybackSeekUi so that it can interact with Seeking UI.

Public methods

open PlaybackSeekDataProvider!

Called by PlaybackSeekUi asking for PlaybackSeekDataProvider.

open Boolean

Called by PlaybackSeekUi to query client if seek is allowed.

open Unit
onSeekFinished(cancelled: Boolean)

Called when cancelled or confirmed.

open Unit

Called when user seeks to a different location.

open Unit

Event for start seeking.

Public constructors

<init>

Client()

Client (e.g. PlaybackGlue) to register on PlaybackSeekUi so that it can interact with Seeking UI. For example client(PlaybackGlue) will pause media when PlaybackSeekUi emits onSeekStarted() event.

Public methods

getPlaybackSeekDataProvider

open fun getPlaybackSeekDataProvider(): PlaybackSeekDataProvider!

Called by PlaybackSeekUi asking for PlaybackSeekDataProvider. This method will be called after isSeekEnabled() returns true. If client does not provide a PlaybackSeekDataProvider, client may directly seek media in onSeekPositionChanged(long).

Return
PlaybackSeekDataProvider!: PlaybackSeekDataProvider or null if no PlaybackSeekDataProvider is available.

isSeekEnabled

open fun isSeekEnabled(): Boolean

Called by PlaybackSeekUi to query client if seek is allowed.

Return
Boolean: True if allow PlaybackSeekUi to start seek, false otherwise.

onSeekFinished

open fun onSeekFinished(cancelled: Boolean): Unit

Called when cancelled or confirmed. When cancelled, client should restore playing from the position before onSeekStarted(). When confirmed, client should seek to last updated onSeekPositionChanged(long).

Parameters
cancelled Boolean: True if cancelled false if confirmed.

onSeekPositionChanged

open fun onSeekPositionChanged(pos: Long): Unit

Called when user seeks to a different location. This callback is called multiple times between onSeekStarted() and onSeekFinished(boolean).

Parameters
pos Long: Position that user seeks to.

onSeekStarted

open fun onSeekStarted(): Unit

Event for start seeking. Client will typically pause media and save the current position in the callback.