PlayerAdapter.Callback


public class PlayerAdapter.Callback


Client for client of PlayerAdapter.

Summary

Public constructors

Public methods

void

Event for getBufferedPosition changed.

void
onBufferingStateChanged(@NonNull PlayerAdapter adapter, boolean start)

Event for buffering start or stop.

void

Event for getCurrentPosition changed.

void

Event for getDuration changed.

void
onError(
    @NonNull PlayerAdapter adapter,
    int errorCode,
    @Nullable String errorMessage
)

Event for error.

void

Event for meta data changed.

void

Client when the current media is finished.

void

Client for Play/Pause state change.

void

Client for isPrepared changed.

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

Event for video size changed.

Public constructors

Callback

Added in 1.1.0
public Callback()

Public methods

onBufferedPositionChanged

Added in 1.1.0
public void onBufferedPositionChanged(@NonNull PlayerAdapter adapter)

Event for getBufferedPosition changed.

Parameters
@NonNull PlayerAdapter adapter

The adapter whose getBufferedPosition changed.

onBufferingStateChanged

Added in 1.1.0
public void onBufferingStateChanged(@NonNull PlayerAdapter adapter, boolean start)

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

Parameters
@NonNull PlayerAdapter adapter

The adapter that begins buffering or finishes buffering.

boolean start

True for buffering start, false otherwise.

onCurrentPositionChanged

Added in 1.1.0
public void onCurrentPositionChanged(@NonNull PlayerAdapter adapter)

Event for getCurrentPosition changed.

Parameters
@NonNull PlayerAdapter adapter

The adapter whose getCurrentPosition changed.

onDurationChanged

Added in 1.1.0
public void onDurationChanged(@NonNull PlayerAdapter adapter)

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

Parameters
@NonNull PlayerAdapter adapter

The adapter whose getDuration changed.

onError

Added in 1.1.0
public void onError(
    @NonNull PlayerAdapter adapter,
    int errorCode,
    @Nullable String errorMessage
)

Event for error.

Parameters
@NonNull PlayerAdapter adapter

The adapter that encounters error.

int errorCode

Optional error code, specific to implementation.

@Nullable String errorMessage

Optional error message, specific to implementation.

onMetadataChanged

Added in 1.1.0
public void onMetadataChanged(@NonNull PlayerAdapter adapter)

Event for meta data changed.

Parameters
@NonNull PlayerAdapter adapter

The adapter that finishes current media item.

onPlayCompleted

Added in 1.1.0
public void onPlayCompleted(@NonNull PlayerAdapter adapter)

Client when the current media is finished.

Parameters
@NonNull PlayerAdapter adapter

The adapter that has just finished current media.

onPlayStateChanged

Added in 1.1.0
public void onPlayStateChanged(@NonNull PlayerAdapter adapter)

Client for Play/Pause state change. See isPlaying.

onPreparedStateChanged

Added in 1.1.0
public void onPreparedStateChanged(@NonNull PlayerAdapter adapter)

Client for isPrepared changed.

Parameters
@NonNull PlayerAdapter adapter

The adapter that has changed ready state.

onVideoSizeChanged

Added in 1.1.0
public void onVideoSizeChanged(@NonNull PlayerAdapter adapter, int width, int height)

Event for video size changed.

Parameters
@NonNull PlayerAdapter adapter

The adapter whose video size has been detected or changed.

int width

Intrinsic width of the video.

int height

Intrinsic height of the video.