PlayerObserver
The interface class which provides callbacks for the player.
onAudioVolumeIndication
Reports the volume indication of the broadcaster.
virtual void onAudioVolumeIndication(int32_t volume) = 0;
- Since
- v4.5.0
Trigger timing
The SDK triggers this callback when the volumn of the broadcaster changes.
Restrictions
None.
Parameters
- volume
- The current volumn of the broadcaster. The value range is [0,225].
onEvent
The player event callback.
virtual void onEvent(PlayerEvent event) = 0;
- Since
- v4.5.0
To monitor player events, you need to call RegisterObserver to register a player observer object.
Trigger timing
The SDK triggers this callback when the player event changes.
Restrictions
None.
Parameters
- event
- The player event. See RtePlayerEvent.
onMetadata [2/2]
Occurs when the metadata is received.
virtual void onMetadata(PlayerMetadataType type,
const uint8_t *data, size_t length) = 0;
- Since
- v4.5.0
To receive the metadata of the media stream, call RegisterObserver to register a player observer object first.
Trigger timing
After the SDK parses the metadata of the media stream being played, it triggers this callback to report the data type and its content.
Restrictions
None.
Parameters
- type
- The metadata type: RtePlayerMetadataType.
- data
- The metadata.
- length
- Size of data (in bytes).
onPlayerInfoUpdated [2/2]
Occurs when the information of the player and the media stream changes.
virtual void onPlayerInfoUpdated(const PlayerInfo *info) = 0;
- Since
- v4.5.0
To receive the information of the player and the media stream, call RegisterObserver to register a player observer object first. You can also get the infomation by calling GetInfo.
Trigger timing
The SDK triggers this callback when the information of the player and the media stream changes.
Restrictions
None.
Parameters
- info
- The information of the player and the media stream. See RtePlayerInfo.
onResolutionChanged
Occurs when video resolution changes.
virtual void onResolutionChanged(int width, int height) = 0;
- Since
- v4.5.0
To monitor the resolution changes of the video stream being played, ensure that you call RegisterObserver to register the player observer first.
Trigger timing
When the resolution of the video stream changes, the SDK triggers this callback to report the current width and height of the video.
Restrictions
None.
Parameters
- width
- The width (px) of the video frame.
- height
- The height (px) of the video frame.
onStateChanged
Occurs when the player state changes.
virtual void onStateChanged(PlayerState old_state, PlayerState new_state,
rte::Error *err) = 0;
- Since
- v4.5.0
To monitor player events, you need to call RegisterObserver to register a player observer object.
Trigger timing
When the player state changes, the SDK triggers this callback the report the previous and current states.
Restrictions
None.
Parameters
- old_state
- The previous player state. See RtePlayerState.
- new_state
- The current player state. See RtePlayerState. If the current state is kRtePlayerStateFailed, you can get the detailed error information from the err parameter.
- err
- The state or error information: Error.