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

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
onStateChanged 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(int error_code);
    Parameter Type Description
    error_code int The error code of the engine.
  • onWarning: the warning notification of the SDK.
    void onWarning(int warning_code);
    Parameter Type Description
    warning_code int The warning code of the engine.
  • onJoinChannelResult: Add channel result callback.
    void onJoinChannelResult(int result);
    Parameter Type Description
    result int Adding a channel returns results. Valid values:
    • 0: The channel is added.
    • Non -0: Failed to join the channel.
  • onLeaveChannelResult: Leave the channel result callback.
    void onLeaveChannelResult(int result);
    Parameter Type Description
    result int Leave the channel to return results. Valid values:
    • 0: Leave the channel successfully.
    • Non -0: Failed to leave the channel.
  • onPublishChangedNotify: callback for stream ingest results.
    void onPublishChangedNotify(int result, boolean isPublished);
    Parameter Type Description
    result int The result of stream ingest is returned. Valid values:
    • 0: The stream is ingested.
    • Non -0: The stream ingest failed.
    isPublished boolean The status of the stream ingest. Valid values:
    • true: starts stream ingest.
    • false: stops stream ingest.
  • onAudioFrameReceived: the callback of the audio raw data.
    void onAudioFrameReceived(AliRTCLinuxEngine.AudioFrame frame);
    Parameter Type Description
    frame AliRTCLinuxEngine.AudioFrame Audio raw data.
  • onVideoFrameReceived: the callback of the original video data.
    void onVideoFrameReceived(String uid, AliRTCLinuxEngine.VideoFrame frame);
    Parameter Type Description
    uid String The ID of the remote user.
    frame AliRTCLinuxEngine.VideoFrame The raw video data.
  • onRemoteUserOnLineNotify: remote user online callback.
    void onRemoteUserOnLineNotify(String uid);
    Parameter Type Description
    uid String The ID of the remote user.
  • onRemoteUserOffLineNotify: remote user offline callback.
    void onRemoteUserOffLineNotify(String uid);
    Parameter Type Description
    uid String The ID of the remote user.
  • onStateChanged: the status change notification of the media player.
    void onStateChanged(AliRTCLinuxMediaPlayer mediaPlayer, AliRTCLinuxMediaPlayer.MediaPlayerState state);
    Parameter Type Description
    mediaPlayer AliRTCLinuxMediaPlayer The instance of the media player.
    state AliRTCLinuxMediaPlayer.MediaPlayerState The current player status.
  • onEventNotify: media player event notification.
    void onEventNotify(AliRTCLinuxMediaPlayer mediaPlayer, AliRTCLinuxMediaPlayer.MediaPlayerEvent event, int errorCode);
    Parameter Type Description
    mediaPlayer AliRTCLinuxMediaPlayer The instance of the media player.
    event AliRTCLinuxMediaPlayer.MediaPlayerEvent The currently received event.
    errorCode int The error code corresponding to the event. 0 indicates no error.
  • onPlayingProgress: callback for playback progress.
    void onPlayingProgress(AliRTCLinuxMediaPlayer mediaPlayer, long millisecond);
    Parameter Type Description
    mediaPlayer AliRTCLinuxMediaPlayer The instance of the media player.
    millisecond long The current playback progress. Unit: milliseconds. Currently, the callback interval is 1 second.
  • onAddVideoWatermarkResult: the callback for adding watermark results.
    void onAddVideoWatermarkResult(AliRTCLinuxEngine.VideoSource videoSource, int result);
    Parameter Type Description
    videoSource AliRTCLinuxEngine.VideoSource The type of the video stream to which the watermark is added.
    result int The result of adding a watermark. Valid values:
    • 0: The watermark is added.
    • Non -0: The watermark failed to be added.
  • onClearVideoWatermarkResult: the callback for the result of deleting the watermark.
    void onClearVideoWatermarkResult(AliRTCLinuxEngine.VideoSource videoSource, int result);
    Parameter Type Description
    videoSource AliRTCLinuxEngine.VideoSource The type of the video stream for which the watermark is cleared.
    result int The result of deleting the watermark. Valid values:
    • 0: The watermark is deleted.
    • Non -0: The watermark failed to be deleted.