Agora Java API Reference for Android
Public Member Functions | Protected Member Functions | List of all members
io.agora.rte.PlayerObserver Class Reference

Public Member Functions

long getNativeHandle ()
 
void onStateChanged (int old_state, int new_state, Error error)
 
void onPositionChanged (long curr_time, long utc_time)
 
void onResolutionChanged (int width, int height)
 
void onEvent (int event)
 
void onMetadata (int type, byte[] data)
 
void onPlayerInfoUpdated (PlayerInfo info)
 
void onAudioVolumeIndication (int volume)
 

Protected Member Functions

void finalize ()
 

Detailed Description

Player Observer, an interface for receiving player event callbacks.

Since
v4.4.0

Member Function Documentation

◆ onStateChanged()

void io.agora.rte.PlayerObserver.onStateChanged ( int  old_state,
int  new_state,
Error  error 
)

Player state callback. This function is called when the player state changes.

Since
v4.4.0
Parameters
old_stateThe previous state.
new_stateThe new state.
errorPossible ErrorCode returns. Only when the new_state value corresponds to Constants.PlayerState.FAILED, you need to check the value of this parameter.
  • ErrorCode.DEFAULT. For specific reasons, see Error.Message, including the following situations:
    • Failed to connect to the channel.
  • ErrorCode.INVALID_ARGUMENT.
    • Invalid appid.
    • Invalid channelid.
    • Invalid uid.
  • ErrorCode.AUTHENTICATION_FAILED.
    • Invalid token.
    • Token expired.
  • ErrorCode.STREAM_NOT_FOUND. After entering the channel, no stream was received from the broadcaster. for more than 10 seconds.
Returns
void

◆ onPositionChanged()

void io.agora.rte.PlayerObserver.onPositionChanged ( long  curr_time,
long  utc_time 
)

Playback position change callback.

Since
v4.4.0

◆ onResolutionChanged()

void io.agora.rte.PlayerObserver.onResolutionChanged ( int  width,
int  height 
)

Video resolution change callback.

Since
v4.4.0
Parameters
widthThe width of the video frame.
heightThe height of the video frame.
Returns
void

◆ onEvent()

void io.agora.rte.PlayerObserver.onEvent ( int  event)

Event callback.

Since
v4.4.0
Parameters
eventThe event notified by the callback. Refer to Constants.PlayerEvent type. Currently, the following events can be handled accordingly:
Returns
void

◆ onMetadata()

void io.agora.rte.PlayerObserver.onMetadata ( int  type,
byte[]  data 
)

Metadata callback.

Since
v4.4.0
Parameters
typeThe type of metadata.
dataThe metadata buffer.
Returns
void

◆ onPlayerInfoUpdated()

void io.agora.rte.PlayerObserver.onPlayerInfoUpdated ( PlayerInfo  info)

Player information update callback. This is called when fields in PlayerInfo are updated.

Since
v4.4.0
Parameters
infoThe current PlayerInfo information.
Returns
void

◆ onAudioVolumeIndication()

void io.agora.rte.PlayerObserver.onAudioVolumeIndication ( int  volume)

Broadcaster audio volume update callback.

Since
v4.4.0
Parameters
volumeThe current volume of the Broadcaster. The value range is [0, 255].
Returns
void