Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
Android 0.0.0 Developer Preview
belongs to Maven artifact androidx.leanback:leanback:1.1.0-alpha01

PlayerAdapter.Callback

public static class PlayerAdapter.Callback
extends Object

java.lang.Object
   ↳ androidx.leanback.media.PlayerAdapter.Callback


Client for client of PlayerAdapter.

Summary

Public constructors

PlayerAdapter.Callback()

Public methods

void onBufferedPositionChanged(PlayerAdapter adapter)

Event for PlayerAdapter.getBufferedPosition() changed.

void onBufferingStateChanged(PlayerAdapter adapter, boolean start)

Event for buffering start or stop.

void onCurrentPositionChanged(PlayerAdapter adapter)

Event for PlayerAdapter.getCurrentPosition() changed.

void onDurationChanged(PlayerAdapter adapter)

Event for PlayerAdapter.getDuration() changed.

void onError(PlayerAdapter adapter, int errorCode, String errorMessage)

Event for error.

void onMetadataChanged(PlayerAdapter adapter)

Event for meta data changed.

void onPlayCompleted(PlayerAdapter adapter)

Client when the current media is finished.

void onPlayStateChanged(PlayerAdapter adapter)

Client for Play/Pause state change.

void onPreparedStateChanged(PlayerAdapter adapter)

Client for PlayerAdapter.isPrepared() changed.

void onVideoSizeChanged(PlayerAdapter adapter, int width, int height)

Event for video size changed.

Inherited methods

Public constructors

PlayerAdapter.Callback

public PlayerAdapter.Callback ()

Public methods

onBufferedPositionChanged

public void onBufferedPositionChanged (PlayerAdapter adapter)

Event for PlayerAdapter.getBufferedPosition() changed.

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

onBufferingStateChanged

public void onBufferingStateChanged (PlayerAdapter adapter, 
                boolean start)

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

Parameters
adapter PlayerAdapter: The adapter that begins buffering or finishes buffering.

start boolean: True for buffering start, false otherwise.

onCurrentPositionChanged

public void onCurrentPositionChanged (PlayerAdapter adapter)

Event for PlayerAdapter.getCurrentPosition() changed.

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

onDurationChanged

public void onDurationChanged (PlayerAdapter adapter)

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

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

onError

public void onError (PlayerAdapter adapter, 
                int errorCode, 
                String errorMessage)

Event for error.

Parameters
adapter PlayerAdapter: The adapter that encounters error.

errorCode int: Optional error code, specific to implementation.

errorMessage String: Optional error message, specific to implementation.

onMetadataChanged

public void onMetadataChanged (PlayerAdapter adapter)

Event for meta data changed.

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

onPlayCompleted

public void onPlayCompleted (PlayerAdapter adapter)

Client when the current media is finished.

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

onPlayStateChanged

public void onPlayStateChanged (PlayerAdapter adapter)

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

Parameters
adapter PlayerAdapter

onPreparedStateChanged

public void onPreparedStateChanged (PlayerAdapter adapter)

Client for PlayerAdapter.isPrepared() changed.

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

onVideoSizeChanged

public void onVideoSizeChanged (PlayerAdapter adapter, 
                int width, 
                int height)

Event for video size changed.

Parameters
adapter PlayerAdapter: The adapter whose video size has been detected or changed.

width int: Intrinsic width of the video.

height int: Intrinsic height of the video.