This topic describes the callback and listener interfaces of the Linux SDK(C++).

Contents

Note The callback method is asynchronous.

AliRtcEngineEventListener: local user behavior callback.

API Description Supported earliest version
OnError The exception notification of the SDK. 1.18.1
OnWarning The warning notification of the SDK. 1.18.1
OnJoinChannelResult Add channel result callback. 1.18.1
OnLeaveChannelResult Leave the channel result callback. 1.18.1
OnPublishChangedNotify The callback for the stream ingest result. 1.18.1
OnAudioFrameReceived The callback of the audio raw data. 1.18.1
OnVideoFrameReceived The callback of the original video data. 1.18.1
OnAddVideoWatermarkResult The callback for adding watermark results. 1.18.11
OnClearVideoWatermarkResult The callback that is used to delete the watermark result. 1.18.11

AliRtcEngineNotify: remote user behavior callback.

API Description Supported earliest version
OnRemoteUserOnLineNotify Remote user launch callback. 1.18.1
OnRemoteUserOffLineNotify Remote user offline callback. 1.18.1
AliRTCMediaPlayerEventHandler: the callback of the media player.
API Description Supported earliest version
OnStateChange The status change notification of the media player. 1.18.1
OnEventNotify Media player event notification. 1.18.1
OnPlayingProgress The callback for the playback progress. 1.18.1

Details

  • OnError: the exception notification of the SDK.
    void OnError(AliRTCSdk::Linux::ERROR_CODE error_code);
    Parameter Type Description
    error_code AliRTCSdk::Linux::ERROR_CODE The error code of the engine.
  • OnWarning: the warning notification of the SDK.
    void OnWarning(AliRTCSdk::Linux::WARNNING_CODE warning_code);
    Parameter Type Description
    warning_code AliRTCSdk::Linux::WARNNING_CODE The warning code of the engine.
  • OnJoinChannelResult: Add channel result callback.
    void OnJoinChannelResult(int result);
    Parameter Type Description
    result int The result returned when the channel is added. 0 indicates that the channel is successfully added. A non -0 indicates that the channel fails to be added.
  • OnLeaveChannelResult: Leave the channel result callback.
    void OnLeaveChannelResult(int result);
    Parameter Type Description
    result int If you leave the channel, the result is returned. 0 indicates that you have successfully left the channel. If you are not 0, you have failed to leave the channel.
  • OnPublishChangedNotify: callback for stream ingest results.
    void OnPublishChangedNotify(int result, bool isPublished);
    Parameter Type Description
    result int The result returned for stream ingest. 0 indicates that the stream ingest is successful. If others are returned, the stream ingest fails.
    isPublished bool The stream ingest status. A value of true indicates that stream ingest is started. A value of false indicates that stream ingest is stopped.
  • OnAudioFrameReceived: the callback of the audio raw data.
    void OnAudioFrameReceived(const AliRTCSdk::Linux::AudioFrame * frame);
    Parameter Type Description
    frame const AliRTCSdk::Linux::AudioFrame * Audio raw data.
  • OnVideoFrameReceived: the callback of the original video data.
    void OnVideoFrameReceived(const char * uid, const AliRTCSdk::Linux::VideoFrame * frame);
    Parameter Type Description
    uid const char * The ID of the remote user.
    frame const AliRTCSdk::Linux::VideoFrame * The raw video data.
  • OnRemoteUserOnLineNotify: remote user online callback.
    void OnRemoteUserOnLineNotify(const char * uid);
    Parameter Type Description
    uid const char * The ID of the remote user.
  • OnRemoteUserOffLineNotify: remote user offline callback.
    void OnRemoteUserOffLineNotify(const char * uid);
    Parameter Type Description
    uid const char * The ID of the remote user.
  • OnStateChange: the status change notification of the media player.
    void OnStateChange(AliRTCMediaPlayerInterface *mediaPlayer, AliRTCSdk::Linux::MediaPlayerState state);
    Parameter Type Description
    mediaPlayer AliRTCMediaPlayerInterface * The instance of the media player.
    state AliRTCSdk::Linux::MediaPlayerState The current player status.
  • OnEventNotify: media player event notification.
    void OnEventNotify(AliRTCMediaPlayerInterface *mediaPlayer, AliRTCSdk::Linux::MediaPlayerEvent event, int errorCode);
    Parameter Type Description
    mediaPlayer AliRTCMediaPlayerInterface * The instance of the media player.
    event AliRTCSdk::Linux::MediaPlayerEvent The currently received event.
    errorCode int The error code corresponding to the event. If no error occurs, the value is 0.
  • OnPlayingProgress: callback for playback progress.
    void OnPlayingProgress(AliRTCMediaPlayerInterface *mediaPlayer, unsigned long long millisecond);
    Parameter Type Description
    mediaPlayer AliRTCMediaPlayerInterface * The instance of the media player.
    millisecond unsigned long long The current playback progress. Unit: milliseconds. Currently, the callback interval is 1 second.
  • OnAddVideoWatermarkResult: the callback for adding watermark results.
    void OnAddVideoWatermarkResult(AliRTCSdk::Linux::VideoSource videoSource, int result);
    Parameter Type Description
    videoSource AliRTCSdk::Linux::VideoSource The type of the video stream to which the watermark is added.
    result int The result of adding a watermark. The value 0 indicates that the watermark is added. If another value is returned, the watermark fails to be added.
  • OnClearVideoWatermarkResult: the callback for the result of deleting the watermark.
    void OnClearVideoWatermarkResult(AliRTCSdk::Linux::VideoSource videoSource, int result);
    Parameter Type Description
    videoSource AliRTCSdk::Linux::VideoSource The type of the video stream for which the watermark is cleared.
    result int The result of deleting the watermark. A value of 0 indicates that the watermark is deleted. If another value is returned, the watermark fails to be deleted.