This topic describes the callback and listener interfaces of the Android SDK.

Contents

AliRtcEngineEventListener: local user behavior callback.
API Description Supported earliest version
onJoinChannelResult Add channel result callback. 1.1
onLiveStreamingSignalingResult Low-latency interactive live stream pull callback. 2.1
onLeaveChannelResult Leave the channel result callback. 1.1
onAudioPublishStateChanged Audio stream ingest change callback. 2.1
onVideoPublishStateChanged The callback for the video stream ingest change. 2.1
onDualStreamPublishStateChanged The callback for stream change of the secondary video stream. 2.1
onScreenSharePublishStateChanged Screen sharing stream ingest change callback. 2.1
onAudioSubscribeStateChanged The callback for audio subscription changes. 2.1
onVideoSubscribeStateChanged The callback for the change of the camera stream subscription. 2.1
onSubscribeStreamTypeChanged The callback for the camera size stream condition change. 2.1
onScreenShareSubscribeStateChanged Callback for change of screen sharing stream subscription. 2.1
onNetworkQualityChanged Callback when the network quality changes. 1.1
onNetworkQualityProbeTest The callback for the network quality probe. 1.16.2
onOccurWarning Warning callback. 1.1
onOccurError Error callback. 1.1
onPerformanceLow The callback for insufficient performance of the current device. 1.16
onPerformanceRecovery The callback for performance recovery of the current device. 1.16
onConnectionLost The network disconnect callback. 1.14
onTryToReconnect Attempt network reconnection callback. 1.14
onConnectionRecovery Callback for successful network reconnection. 1.14
onConnectionStatusChange Callback for network connection status change. 2.1
onUpdateRoleNotify Callback when the user role changes. 1.16
onSnapshotComplete Screenshot callback. 2.1
onPublishLiveStreamStateChanged Callback for bypass ingest status change. 2.1
onPublishTaskStateChanged The callback for the status change of the bypass task. 2.1
AliRtcEngineNotify: remote user behavior callback.
API Description Supported earliest version
onRemoteUserOnLineNotify Remote user launch callback. 1.1
onRemoteUserOffLineNotify Remote user offline callback. 1.1
onRemoteTrackAvailableNotify Callback when the audio and video streams of remote users change. 1.1
onFirstRemoteVideoFrameDrawn The callback when the first frame of the remote video stream is rendered. 1.16.2
onFirstLocalVideoFrameDrawn This message is triggered when the preview starts to display the first video frame. 1.17.2
onFirstVideoFrameReceived Callback for receiving the first frame of the remote user's video. 2.1
onFirstVideoPacketSent The callback for sending the first packet of a video. 2.1
onFirstAudioPacketSent The callback for sending the first audio packet. 2.1
onFirstVideoPacketReceived The callback for receiving the first video packet. 2.1
onFirstAudioPacketReceived The callback for receiving the first audio packet. 2.1
onFirstRemoteAudioDecoded The callback for the first frame of the decoded remote audio. 2.1
onBye Callback when the server is kicked out or the channel is closed. 1.1
onAliRtcStats Callback for current session statistics. 1.16
onUserAudioMuted The peer user stops sending notifications about audio data. 1.16.3
onUserVideoMuted Send a notification for sending video black frame data to the end user. 1.16.3
onUserVideoEnabled Disable camera stream collection for the peer user to send notifications. 2.1
onUserAudioInterruptedBegin User audio is interrupted notification. 1.17
onUserAudioInterruptedEnded User audio interruption end notification. 1.17
onUserWillResignActive The remote user application is retreated to the background. 1.17
onUserWillBecomeActive The remote user application returns to the foreground. 1.17
onAudioPlayingStateChanged The local accompaniment plays the callback. 1.16.2
onRemoteAudioAccompanyStarted The remote user accompaniment starts playing. 2.1
onRemoteAudioAccompanyFinished The remote user accompaniment ends playing. 2.1
onAudioEffectFinished The callback for the end of local sound playback. 1.17.30
onMediaRecordEvent Recording event callback. 1.17
onRtcLocalVideoStats The callback for local video statistics. 1.17
onRtcRemoteVideoStats Remote video statistics callback. 1.17
onRtcRemoteAudioStats The local audio statistics. 2.1
onRtcLocalAudioStats The statistics on remote audio. 2.1
onMediaExtensionMsgReceived The callback for receiving the media extension information. 1.17.1
onUplinkChannelMessage The result notification of the message sent by the client to the server. 2.1
onAudioFocusChange The callback for the notification of the result of the audio focus change. 1.17
onAudioRouteChanged Callback for voice route changes. 2.1
onMessage The signaling channel used by the Sass layer. 2.1
onChannelRelayStateChanged Cross-channel wheat status changes. 2.1
onChannelRelayEvent The cross-channel wheat incident. 2.1
onRemoteVideoChanged Remote video stream change callback. 2.4
AliRtcVideoObserver: Naked video data callback.
API Description Supported earliest version
onLocalVideoSample The locally collected video data of the subscription. 1.17
onRemoteVideoSample The remote video data of the subscription. 1.17
onPreEncodeVideoSample The pre-encoded video data of the subscription. 2.1
onGetVideoFormatPreference Video data output format. 2.1
onGetObservedFramePosition Video data output location. 2.1
onGetIfUserFetchObserverData Specifies whether the video output data is obtained by the user. 2.4
onGetVideoAlignment The alignment of video data output. 2.4
onGetObserverDataMirrorApplied Indicates whether the video output data needs to be mirrored. 2.4
onGetSmoothRenderingEnabled Specifies whether to output the stream video data smoothly. 2.4
AliRtcAudioObserver: audio bare data callback.
API Description Supported earliest version
onCaptureRawData Collect audio data locally. 1.17
onCaptureData Ingest audio data locally. 1.17
onRenderData Subscribe to audio data locally. 1.17
onPlaybackAudioFrameBeforeMixing The audio data of the specified user before mixing. 2.1
AliRtcAudioVolumeObserver: registers the volume callback.
API Description Supported earliest version
onAudioVolume User volume size callback. 1.16.2
onActiveSpeaker The current speaker of the subscription. 2.1
AliRtcTextureObserver: video texture callback.
API Description Supported earliest version
onTextureCreate Video GL texture creation callback. 1.15
onTextureUpdate Video GL texture update callback. 1.15
onTextureDestroy Video GL texture destruction callback. 1.15

Details

  • onJoinChannelResult: Add channel result callback.
    public void onJoinChannelResult(int result, String channel, int elapsed);
    Parameter Type Description
    result int The result of adding a channel. 0 is returned if it is successful and an error code is returned if it fails.
    channel String The ID of the channel.
    elapsed int The duration of joining the channel. Unit: milliseconds.
  • onLiveStreamingSignalingResult: callback for low-latency interactive live streaming.
    public void onLiveStreamingSignalingResult(int result);
    Parameter Type Description
    result int The result of the live stream pulling. 0 is returned if it is successful. Others are returned if it fails.
  • onLeaveChannelResult: Leave the channel result callback.

    This callback is returned after you call the leaveChannel operation. If you directly destroy the SDK after you leave the channel, you will not receive this callback.

    public void onLeaveChannelResult(int result, AliRtcEngine.AliRtcStats stats);
    Parameter Type Description
    result int If you leave the channel, 0 is returned for success and an error code is returned for failure.
    stats AliRtcStats Statistics summary of the sessions in this channel.
  • onAudioPublishStateChanged: audio stream ingest change callback.
    public void onAudioPublishStateChanged(AliRtcEngine.AliRtcPublishState oldState , 
                                           AliRtcEngine.AliRtcPublishState newState,
                                               int elapseSinceLastState, String channel);
    Parameter Type Description
    oldState AliRtcPublishState The previous stream ingest status.
    newState AliRtcPublishState The current stream ingest status.
    elapseSinceLastState int The interval at which the status changes. Unit: milliseconds.
    channel String The ID of the current channel.
  • onVideoPublishStateChanged: the callback for video stream ingest change.
    public void onVideoPublishStateChanged(AliRtcEngine.AliRtcPublishState oldState , 
                                           AliRtcEngine.AliRtcPublishState newState, 
                                           int elapseSinceLastState, String channel);
    Parameter Type Description
    oldState AliRtcPublishState The previous stream ingest status.
    newState AliRtcPublishState The current stream ingest status.
    elapseSinceLastState int The interval at which the status changes. Unit: milliseconds.
    channel String The ID of the current channel.
  • onDualStreamPublishStateChanged: callback for stream change of secondary video stream.
    public void onDualStreamPublishStateChanged(AliRtcEngine.AliRtcPublishState oldState , 
                                                AliRtcEngine.AliRtcPublishState newState, 
                                                int elapseSinceLastState, String channel);
    Parameter Type Description
    oldState AliRtcPublishState The previous stream ingest status.
    newState AliRtcPublishState The current stream ingest status.
    elapseSinceLastState int The interval at which the status changes. Unit: milliseconds.
    channel String The ID of the current channel.
  • onScreenSharePublishStateChanged: Screen sharing stream ingest change callback.
    public void onScreenSharePublishStateChanged(AliRtcEngine.AliRtcPublishState oldState ,
                                                 AliRtcEngine.AliRtcPublishState newState,
                                                 int elapseSinceLastState, String channel);
    Parameter Type Description
    oldState AliRtcPublishState The previous stream ingest status.
    newState AliRtcPublishState The current stream ingest status.
    elapseSinceLastState int The interval at which the status changes. Unit: milliseconds.
    channel String The ID of the current channel.
  • onAudioSubscribeStateChanged: the callback for audio subscription changes.
    public void onAudioSubscribeStateChanged(String uid,
                                             AliRtcEngine.AliRtcSubscribeState oldState,
                                             AliRtcEngine.AliRtcSubscribeState newState,
                                             int elapseSinceLastState, String channel);
    Parameter Type Description
    uid String The ID of the remote user.
    oldState AliRtcSubscribeState The previous subscription status.
    newState AliRtcSubscribeState The current subscription status.
    elapseSinceLastState int The interval at which the status changes. Unit: milliseconds.
    channel String The ID of the current channel.
  • onVideoSubscribeStateChanged: the callback for the change of the camera stream subscription.
    public void onVideoSubscribeStateChanged(String uid,
                                             AliRtcEngine.AliRtcSubscribeState oldState,
                                             AliRtcEngine.AliRtcSubscribeState newState,
                                             int elapseSinceLastState, String channel);
    Parameter Type Description
    uid String The ID of the remote user.
    oldState AliRtcSubscribeState The previous subscription status.
    newState AliRtcSubscribeState The current subscription status.
    elapseSinceLastState int The interval at which the status changes.
    channel String The ID of the current channel.
  • onSubscribeStreamTypeChanged: the callback for the camera size stream change.
    public void onSubscribeStreamTypeChanged(String uid,
                                             AliRtcEngine.AliRtcVideoStreamType oldStreamType,
                                             AliRtcEngine.AliRtcVideoStreamType newStreamType,
                                             int elapseSinceLastState, String channel);
    Parameter Type Description
    uid String The ID of the remote user.
    oldState AliRtcVideoStreamType The previous subscription status.
    newState AliRtcVideoStreamType The current subscription status.
    elapseSinceLastState int The interval at which the status changes. Unit: milliseconds.
    channel String The ID of the current channel.
  • onScreenShareSubscribeStateChanged: Screen sharing stream subscription status change callback.
    public void onScreenShareSubscribeStateChanged(String uid,
                                                   AliRtcEngine.AliRtcSubscribeState oldState,
                                                   AliRtcEngine.AliRtcSubscribeState newState,
                                                   int elapseSinceLastState, String channel);
    Parameter Type Description
    uid String The ID of the remote user.
    oldState AliRtcSubscribeState The previous subscription status.
    newState AliRtcSubscribeState The current subscription status.
    elapseSinceLastState int The interval at which the status changes. Unit: milliseconds.
    channel String The ID of the current channel.
  • onNetworkQualityChanged: callback when the network quality changes.
    public void onNetworkQualityChanged(String uid, AliRtcNetworkQuality upQuality, AliRtcNetworkQuality downQuality);
    Parameter Type Description
    uid String The ID of the user whose network quality has changed. If the user ID is empty, it means local, and others means remote.
    upQuality AliRtcNetworkQuality Upstream network quality.
    downQuality AliRtcNetworkQuality The downstream network quality.
  • onNetworkQualityProbeTest: network quality detection callback.
    public void onNetworkQualityProbeTest(AliRtcNetworkQuality quality);
    Parameter Type Description
    networkQuality AliRtcNetworkQuality Network quality.
  • onOccurWarning: a warning callback.

    Currently, the warning callback can be ignored and will not affect the normal operation.

    public void onOccurWarning(int warn, String message);
    Parameter Type Description
    warn int The type of the warning.
    msg String Warning instructions.
  • onOccurError: the error callback.
    Note If the error parameter is set to 16908812 or 33620229, you need to call the destroy interface to destroy the instance, recreate the SDK instance, and then call the joinChannel interface to join the channel.
    public void onOccurError(int error, String message);
    Parameter Type Description
    error int The type of the error that occurred.
    msg String The error description.
  • onPerformanceLow: the callback for insufficient performance of the current device.
    public void onPerformanceLow();
  • onPerformanceRecovery: the callback for performance recovery of the current device.
    public void onPermormanceRecovery();
  • onConnectionLost: network disconnection callback.
    public void onConnectionLost();
  • onTryToReconnect: Attempt the network reconnection callback.
    public void onTryToReconnect();
  • onConnectionRecovery: The callback for successful network reconnection.
    public void onConnectionRecovery();
  • onConnectionStatusChange: the callback for the network connection status change.
    public void onConnectionStatusChange(AliRtcEngine.AliRtcConnectionStatus status,
                                         AliRtcEngine.AliRtcConnectionStatusChangeReason reason);
    Parameter Type Description
    status AliRtcConnectionStatus The current network link status.
    reason AliRtcConnectionStatusChangeReason The reason why the network link status changes.
  • onUpdateRoleNotify: callback when the user role changes.
    public void onUpdateRoleNotify(AliRtcEngine.AliRTCSdkClientRole oldRole, 
                                   AliRtcEngine.AliRTCSdkClientRole newRole);
    Parameter Type Description
    oldRole AliRTCSdkClientRole The role before the switch.
    newRole AliRTCSdkClientRole The role after the switch.
  • onSnapshotComplete: screenshot callback.
    public void onSnapshotComplete(String userId, AliRtcVideoTrack trackType,
                                   Bitmap bitmap, boolean success);
    Parameter Type Description
    userId String The ID of the user.
    trackType AliRtcVideoTrack Screenshot Video Track.
    bitmap Bitmap The Bitmap object that returns the screenshot.
    success boolean Indicates whether the screenshot was successful.
  • onPublishLiveStreamStateChanged: callback for bypass ingest status change.
    public void onPublishLiveStreamStateChanged(String streamUrl, AliRtcLiveTranscodingState state, AliEngineLiveTranscodingErrorCode errorCode);
    Parameter Type Description
    streamUrl String The URL used to ingest streams to the LiveChannel.
    state AliRtcLiveTranscodingState The status of the bypass live broadcast.
    errorCode AliEngineLiveTranscodingErrorCode The error code returned.
  • onPublishTaskStateChanged: callback for the status change of the bypass task.
    public void onPublishTaskStateChanged(String streamUrl, AliRtcTrascodingPublishTaskStatus state);
    Parameter Type Description
    streamUrl String The URL used to ingest streams to the LiveChannel.
    state AliRtcTrascodingPublishTaskStatus The status of the bypass live stream ingest task.
  • onRemoteUserOnLineNotify: remote user online callback.
    public void onRemoteUserOnLineNotify(String uid, int elapsed);
    Parameter Type Description
    uid String The ID of the remote user.
    elapsed int The duration when the user joins the channel. Unit: milliseconds.
  • onRemoteUserOffLineNotify: remote user offline callback.
    public void onRemoteUserOffLineNotify(String uid, AliRtcUserOfflineReason reason);
    Parameter Type Description
    uid String The ID of the remote user.
    reason AliRtcUserOfflineReason The reason why the user is offline.
  • onRemoteTrackAvailableNotify: callback when the audio and video streams of remote users change.
    public void onRemoteTrackAvailableNotify(String uid, AliRtcAudioTrack audioTrack,
                                                        AliRtcVideoTrack videoTrack);
    Parameter Type Description
    uid String The ID of the remote user.
    audioTrack AliRtcVideoTrack The audio stream after the remote user changes.
    videoTrack AliRtcVideoTrack The video stream after the remote user changes.
  • onFirstRemoteVideoFrameDrawn: The callback for the first frame of the remote video stream to be rendered.
    public void onFirstRemoteVideoFrameDrawn(String uid,AliRtcVideoTrack videoTrack,
                                                 int width, int height, int elapsed);
    Parameter Type Description
    uid String The ID of the remote user.
    videoTrack AliRtcVideoTrack The type of the video stream that is rendered.
    width int The width of the video.
    height int The height of the video.
    elapsed int The total duration. Unit: milliseconds.
  • onFirstLocalVideoFrameDrawn: This message is triggered when the preview starts to display the first video frame.
    public void onFirstLocalVideoFrameDrawn(int width, int height, int elapsed);
    Parameter Type Description
    width int The width of the video.
    height int The height of the video.
    elapsed int The total duration. Unit: milliseconds.
  • onFirstVideoFrameReceived: The callback for receiving the first frame of the remote user's video.
    public void onFirstVideoFrameReceived(String uid, AliRtcVideoTrack videoTrack, int timeCost);
    Parameter Type Description
    uid String The ID of the remote user.
    videoTrack AliRtcVideoTrack The type of the video stream that is rendered.
    timeCost int The amount of time consumed. Unit: milliseconds.
  • onFirstVideoPacketSent: the callback for sending the first video packet.
    public void onFirstVideoPacketSent(String userId, AliRtcVideoTrack videoTrack, int timeCost);
    Parameter Type Description
    userId String The ID of the user.
    videoTrack AliRtcVideoTrack Send a video stream.
    timeCost int The amount of time consumed. Unit: milliseconds.
  • onFirstAudioPacketSent: the callback for sending the first audio packet.
    public void onFirstAudioPacketSent(String userId, int timeCost);
    Parameter Type Description
    userId String The ID of the user.
    timeCost int The amount of time consumed. Unit: milliseconds.
  • onFirstVideoPacketReceived: the callback for receiving the first video packet.
    public void onFirstVideoPacketReceived(String userId, AliRtcVideoTrack videoTrack, int timeCost);
    Parameter Type Description
    userId String The ID of the user.
    videoTrack AliRtcVideoTrack Receive video streams.
    timeCost int The amount of time consumed. Unit: milliseconds.
  • onFirstAudioPacketReceived: the callback for receiving the first audio packet.
    public void onFirstAudioPacketReceived(String userId,int timeCost);
    Parameter Type Description
    userId String The ID of the user.
    timeCost int The amount of time consumed. Unit: milliseconds.
  • onFirstRemoteAudioDecoded: The callback for the first frame of the decoded remote audio.
    public void onFirstRemoteAudioDecoded(String uid, int timeCost);
    Parameter Type Description
    uid String The ID of the remote user.
    elapsed int The amount of time consumed. Unit: milliseconds.
  • onBye: callback when the server is kicked out or the channel is closed.
    public void onBye(int code);
    Parameter Type Description
    code int The onBye type. For more information, see AliRtcOnByeType.
  • onAliRtcStats: callback for current session statistics.
    public void onAliRtcStats(AliRtcEngine.AliRtcStats stats);

    The SDK triggers this statistics callback every two seconds.

    Parameter Type Description
    stats AliRtcStats Session statistics.
  • onUserAudioMuted: The peer user stops sending notifications about audio data.
    public void onUserAudioMuted(String uid ,boolean isMute);
    Parameter Type Description
    uid String The user who executes muteAudio.
    isMute boolean Specifies whether to mute. Valid values:
    • true: mute.
    • false: The instance is not muted.
  • onUserVideoMuted: The peer user sends a notification on the video black frame data.
    public void onUserVideoMuted(String uid ,boolean isMute);
    Parameter Type Description
    uid String The user who executed the enableLocalVideo.
    isMute boolean Specifies whether to send black frames. Valid values:
    • true: ingest black frames.
    • false: The stream is ingested normally.
  • onUserVideoEnabled: Disable Camera Stream Collection for peer users to send notifications.
    public void onUserVideoEnabled(String uid, boolean isMute);
    Parameter Type Description
    uid String The ID of the remote user.
    isMute boolean Specifies whether to enable camera stream collection. Valid values:
    • true: enables camera stream collection.
    • false: disables camera stream collection.
  • onUserAudioInterruptedBegin: The user audio is interrupted.
    public void onUserAudioInterruptedBegin(String uid);
    Parameter Type Description
    uid String The user whose audio was interrupted.
  • onUserAudioInterruptedEnded: user audio interruption end notification.
    public void onUserAudioInterruptedEnded(String uid);
    Parameter Type Description
    uid String The user whose audio was interrupted.
  • onUserWillResignActive: The remote user application is retreated to the background.
    public void onUserWillResignActive(String uid);
    Parameter Type Description
    uid String The ID of the user.
  • onUserWillBecomeActive: The remote user application returns to the foreground.
    public void onUserWillBecomeActive(String uid);
    Parameter Type Description
    uid String The ID of the user.
  • onAudioPlayingStateChanged: local accompaniment playback callback.
    public void onAudioPlayingStateChanged(AliRtcEngine.AliRtcAudioPlayingStateCode playState, 
                                           AliRtcEngine.AliRtcAudioPlayingErrorCode errorCode);
    Parameter Type Description
    playState AliRtcAudioPlayingStateCode The current playback status.
    errorCode AliRtcAudioPlayingErrorCode The error code returned.
  • onRemoteAudioAccompanyStarted: The remote user accompaniment starts playing.
    public void onRemoteAudioAccompanyStarted(String uid);
    Parameter Type Description
    uid String The ID of the user.
  • onRemoteAudioAccompanyFinished: The remote user accompaniment ends.
    public void onRemoteAudioAccompanyFinished(String uid);
    Parameter Type Description
    uid String The ID of the user.
  • onAudioEffectFinished: the callback for the end of local sound playback.
    void OnAudioEffectFinished(int soundId);
    Parameter Type Description
    soundId int The ID assigned by the user to the sound effect file.
  • onMediaRecordEvent: the callback for recording events.
    public void onMediaRecordEvent(int event, String filePath);
    Parameter Type Description
    event int Record events. Valid values:
    • 0: The recording starts.
    • 1: The recording ends.
    • 2: Failed to open the file.
    • 3: Failed to write the file.
    filePath String The path of the recording file.
  • onRtcLocalVideoStats: local video statistics.
    public void onRtcLocalVideoStats(AliRtcEngine.RtcLocalVideoStats localVideoStats);

    The SDK triggers this statistics callback every two seconds.

    Parameter Type Description
    localVideoStats RtcLocalVideoStats The statistics on local videos.
  • onRtcRemoteVideoStats: remote video statistics.
    public void onRtcRemoteVideoStats(AliRtcEngine.RtcRemoteVideoStats aliRtcStats);

    The SDK triggers this statistics callback every two seconds.

    Parameter Type Description
    remoteVideoStats RtcRemoteVideoStats The statistics on remote videos.
  • onRtcRemoteAudioStats: local audio statistics.
    public void onRtcRemoteAudioStats(AliRtcEngine.RtcRemoteAudioStats aliRtcStats);

    The SDK triggers this statistics callback every two seconds.

    Parameter Type Description
    aliRtcStats RtcRemoteAudioStats The local audio statistics.
  • onRtcLocalAudioStats: remote audio statistics.
    public void onRtcLocalAudioStats(AliRtcEngine.RtcLocalAudioStats aliRtcStats);

    The SDK triggers this statistics callback every two seconds.

    Parameter Type Description
    aliRtcStats RtcLocalAudioStats The statistics on remote audio.
  • onMediaExtensionMsgReceived: The callback for media extension information is received.
    public void onMediaExtensionMsgReceived(String uid, byte[] message);

    When a user in the room sends custom data, you can use this callback to receive the data.

    Parameter Type Description
    uid String The ID of the user.
    message byte[] The received custom data.
  • onUplinkChannelMessage: the signaling interface of Sass. The client sends a message result notification to the server.
    public void onUplinkChannelMessage(int result, String contentType, String content);
    Parameter Type Description
    result int The result of sending the message.
    contentType String The signaling type.
    content String The signaling content.
  • onAudioFocusChange: the result notification of the audio focus change.
    public void onAudioFocusChange(int focusChange);

    The SDK internally requests the audio focus. If the external audio focus is used again, you need to request it again in the callback that receives the SDK change.

    Parameter Type Description
    focusChange int The audio status.
  • onAudioRouteChanged: callback for voice route changes.
    public void onAudioRouteChanged(AliRtcEngine.AliRtcAudioRouteType routing);
    Parameter Type Description
    routing AliRtcAudioRouteType The voice route currently in use.
  • onMessage: the signaling channel used by the Sass layer.
    public void onMessage(String tid, String contentType, String content);
    Parameter Type Description
    tid String The signaling ID.
    contentType String The signaling type.
    content String The signaling content.
  • onChannelRelayStateChanged: Cross-channel continuous wheat status changes.
    public void onChannelRelayStateChanged(int state, int code, String message);
    Parameter Type Description
    state int Current wheat status.
    code int The current status code.
    msg String The description of the status.
  • onChannelRelayEvent: Cross-channel Lian Mai incident.
    public void onChannelRelayEvent(int event);
    Parameter Type Description
    event int The HTTP status code.
  • onRemoteVideoChanged: remote video stream change callback.
    public void onRemoteVideoChanged(String uId, AliRtcVideoTrack videoTrack, AliRtcVideoState videoState, AliRtcVideoReason videoReason);
    Parameter Type Description
    uId String The ID of the user.
    videoTrack AliRtcVideoTrack The type of the video stream.
    videoState AliRtcVideoState The status of the video stream changes.
    videoReason AliRtcVideoReason The reason why the status of the video stream is changed.
  • onLocalVideoSample: the callback for subscribed locally collected video data.
    public boolean onLocalVideoSample(AliVideoSourceType sourceType,
                                      AliVideoSample videoSample){return false;}

    return true: The SDK must be written back. This parameter is valid only for I420.

    return false: You do not need to write back the SDK.

    Parameter Type Description
    sourceType AliVideoSourceType The type of the video stream.
    videoSample AliVideoSample Frame data.
  • onRemoteVideoSample: the callback for subscribed remote video data.
    public boolean onRemoteVideoSample(String uid, AliVideoSourceType sourceType, 
                                       AliVideoSample videoSample){return false;}

    return true: The SDK must be written back. This parameter is valid only for I420.

    return false: You do not need to write back the SDK.

    Parameter Type Description
    uid String The ID of the user.
    sourceType AliVideoSourceType The type of the video stream.
    videoSample AliVideoSample Frame data.
  • onPreEncodeVideoSample: the pre-encoded video data of the subscription.
    public boolean onPreEncodeVideoSample(AliVideoSourceType sourceType, 
                                          AliVideoSample videoRawData){return false;}

    return true: The SDK must be written back. This parameter is valid only for I420.

    return false: You do not need to write back the SDK.

    Parameter Type Description
    videoSource AliVideoSourceType The type of the video stream.
    videoRawData AliVideoSample Frame data.
  • onGetVideoFormatPreference: video data output format.
    public AliEngineVideoFormat onGetVideoFormatPreference()
    {return AliEngineVideoFormat.AliEngineVideoFormatI420;}
  • onGetObservedFramePosition: the video data output location.
    public int onGetObservedFramePosition()
    {return AliEngineVideoObserPosition.AliEnginePositionPostCapture.getValue() | 
    AliEngineVideoObserPosition.AliEnginePositionPreRender.getValue();}
  • onGetIfUserFetchObserverData: whether the video output data is obtained by the user.
    public boolean onGetIfUserFetchObserverData(){return false;}
    Return result

    true indicates that the video output data is obtained by the user. false indicates that the video output data is obtained by the SDK callback. Default value: false.

  • onGetVideoAlignment: the video data output alignment.
    public int onGetVideoAlignment(){
                return AliRtcVideoObserAlignment.AliRtcAlignmentDefault.getValue();
            }
    Return result

    The data alignment type of the returned bare data callback. Default value: AliRtcAlignmentDefault.

  • onGetObserverDataMirrorApplied: whether the video output data needs to be mirrored.
    public boolean onGetObserverDataMirrorApplied(){return false;}
    Return result

    true indicates that the video output data needs to be mirrored. false indicates that the video output data does not need to be mirrored. Default value: false.

  • onGetSmoothRenderingEnabled: indicates whether the pull-stream video data is output smoothly.
    public boolean onGetSmoothRenderingEnabled(){return false;}
    Return result

    true indicates that the pull-stream video data is output smoothly. false indicates that the pull-stream video data is output directly. Default value: false.

    Note If and only if the onGetIfUserFetchObserverData returns false, the smooth output of the pull-stream video data takes effect.
  • onCaptureRawData: the callback for locally collected audio data.
    void onCaptureRawData(AliAudioSample aliAudioSample);
    Parameter Type Description
    aliAudioSample AliAudioSample The audio data.
  • onCaptureData: the callback for local streaming audio data.
    void onCaptureData(AliAudioSample aliAudioSample);
    Parameter Type Description
    aliAudioSample AliAudioSample The audio data.
  • onRenderData: the callback for locally subscribed audio data.
    void onRenderData(AliAudioSample aliAudioSample);
    Parameter Type Description
    aliAudioSample AliAudioSample The audio data.
  • onPlaybackAudioFrameBeforeMixing: local subscription audio data callback.
    void onPlaybackAudioFrameBeforeMixing(String uid, AliAudioSample aliAudioSample);
    Parameter Type Description
    uid String The ID of the user.
    aliAudioSample AliAudioSample The audio data.
  • onAudioVolume: the audio volume, voice status, and uid of the subscription.
    public void onAudioVolume(List<AliRtcEngine.AliRtcAudioVolume> speakers, int totalVolume);
    Parameter Type Description
    speakers List<AliRtcEngine.AliRtcAudioVolume> callback user volume information array, including user uid, voice status, and volume.

    When uid is 0, it indicates the local speaker.

    totalVolume int The total volume after mixing. Valid values:[0,255].

    In the callback of the local user, totalVolume is the volume after the local user mixes. In the callback of the remote user, totalVolume is the total volume after all speakers mixes.

  • onActiveSpeaker: Subscribe to the person who is currently talking.
    public void OnActiveSpeaker(String uid);
    Parameter Type Description
    uid String The uid of the speaker. When uid is 0, it indicates the local speaker. It returns the user ID with the largest sound in the current time period, not the user ID with the largest instantaneous sound.
  • onTextureCreate: Video GL texture creation callback.
    void onTextureCreate(long context);
    Parameter Type Description
    context long The thread-related context variable of opengl.
  • onTextureUpdate: Video GL texture update callback.
    int onTextureUpdate(int textureId, int width, int height, AliVideoSample videoSample);
    Parameter Type Description
    textureId int The ID of the video data texture type.
    width int The width of the remote videos.
    height int The height of the remote videos.
    videoSample AliVideoSample Video data.
  • onTextureDestroy: Video GL texture destruction callback.
    void onTextureDestroy();