Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

Callback

open class Callback
kotlin.Any
   ↳ androidx.leanback.media.PlayerAdapter.Callback

Client for client of PlayerAdapter.

Summary

Public constructors

Client for client of PlayerAdapter.

Public methods
open Unit

Client for Play/Pause state change.

open Unit

Client for isPrepared() changed.

open Unit

Event for getDuration() changed.

open Unit

Event for meta data changed.

open Unit

Event for getCurrentPosition() changed.

open Unit
onVideoSizeChanged(adapter: PlayerAdapter!, width: Int, height: Int)

Event for video size changed.

open Unit

Event for buffering start or stop.

open Unit

Event for getBufferedPosition() changed.

open Unit

Client when the current media is finished.

open Unit
onError(adapter: PlayerAdapter!, errorCode: Int, errorMessage: String!)

Event for error.

Public constructors

<init>

Callback()

Client for client of PlayerAdapter.

Public methods

onPlayStateChanged

open fun onPlayStateChanged(adapter: PlayerAdapter!): Unit

Client for Play/Pause state change. See isPlaying().

onPreparedStateChanged

open fun onPreparedStateChanged(adapter: PlayerAdapter!): Unit

Client for isPrepared() changed.

Parameters
adapter PlayerAdapter!: The adapter that has changed ready state.

onDurationChanged

open fun onDurationChanged(adapter: PlayerAdapter!): Unit

Event for getDuration() changed. Usually the duration does not change after playing except for live stream.

Parameters
adapter PlayerAdapter!: The adapter whose getDuration() changed.

onMetadataChanged

open fun onMetadataChanged(adapter: PlayerAdapter!): Unit

Event for meta data changed.

Parameters
adapter PlayerAdapter!: The adapter that finishes current media item.

onCurrentPositionChanged

open fun onCurrentPositionChanged(adapter: PlayerAdapter!): Unit

Event for getCurrentPosition() changed.

Parameters
adapter PlayerAdapter!: The adapter whose getCurrentPosition() changed.

onVideoSizeChanged

open fun onVideoSizeChanged(adapter: PlayerAdapter!, width: Int, height: Int): Unit

Event for video size changed.

Parameters
adapter PlayerAdapter!: The adapter whose video size has been detected or changed.
width PlayerAdapter!: Intrinsic width of the video.
height PlayerAdapter!: Intrinsic height of the video.

onBufferingStateChanged

open fun onBufferingStateChanged(adapter: PlayerAdapter!, start: Boolean): Unit

Event for buffering start or stop. Initial default value is false.

Parameters
adapter PlayerAdapter!: The adapter that begins buffering or finishes buffering.
start PlayerAdapter!: True for buffering start, false otherwise.

onBufferedPositionChanged

open fun onBufferedPositionChanged(adapter: PlayerAdapter!): Unit

Event for getBufferedPosition() changed.

Parameters
adapter PlayerAdapter!: The adapter whose getBufferedPosition() changed.

onPlayCompleted

open fun onPlayCompleted(adapter: PlayerAdapter!): Unit

Client when the current media is finished.

Parameters
adapter PlayerAdapter!: The adapter that has just finished current media.

onError

open fun onError(adapter: PlayerAdapter!, errorCode: Int, errorMessage: String!): Unit

Event for error.

Parameters
adapter PlayerAdapter!: The adapter that encounters error.
errorCode PlayerAdapter!: Optional error code, specific to implementation.
errorMessage PlayerAdapter!: Optional error message, specific to implementation.