This topic describes the callbacks and listeners in the Android software development kit (SDK) API.
Table of contents
| API | Description | Minimum supported version |
| onJoinChannelResult | Callback for the result of joining a channel. | 1.1 |
| onLiveStreamingSignalingResult | Callback for low-latency interactive stream pulling. | 2.1 |
| onLeaveChannelResult | Callback for the result of leaving a channel. | 1.1 |
| onAudioPublishStateChanged | Callback for audio ingest state changes. | 2.1 |
| onVideoPublishStateChanged | Callback for video ingest state changes. | 2.1 |
| onDualStreamPublishStateChanged | Callback for secondary video stream ingest state changes. | 2.1 |
| onScreenSharePublishStateChanged | Callback for screen sharing ingest state changes. | 2.1 |
| onAudioSubscribeStateChanged | Callback for audio subscription state changes. | 2.1 |
| onVideoSubscribeStateChanged | Callback for camera stream subscription state changes. | 2.1 |
| onSubscribeStreamTypeChanged | Callback for changes in the subscribed camera stream type (high or low resolution). | 2.1 |
| onScreenShareSubscribeStateChanged | Callback for screen sharing stream subscription state changes. | 2.1 |
| onNetworkQualityChanged | Callback for when network quality changes. | 1.1 |
| onNetworkQualityProbeTest | Callback for network quality probing. | 1.16.2 |
| onOccurWarning | Warning callback. | 1.1 |
| onOccurError | Error callback. | 1.1 |
| onPerformanceLow | Callback for when the current device performance is low. | 1.16 |
| onPerformanceRecovery | Callback for when the current device performance recovers. | 1.16 |
| onConnectionLost | Callback for network disconnection. | 1.14 |
| onTryToReconnect | Callback for attempting to reconnect to the network. | 1.14 |
| onConnectionRecovery | Callback for successful network reconnection. | 1.14 |
| onConnectionStatusChange | Callback for network connection status changes. | 2.1 |
| onUpdateRoleNotify | Callback for when the user role changes. | 1.16 |
| onSnapshotComplete | Snapshot callback. | 2.1 |
| onPublishLiveStreamStateChanged | Callback for bypass stream ingest state changes. | 2.1 |
| onPublishTaskStateChanged | Callback for bypass task state changes. | 2.1 |
| API | Description | Minimum supported version |
| onRemoteUserOnLineNotify | Callback for when a remote user comes online. | 1.1 |
| onRemoteUserOffLineNotify | Callback for when a remote user goes offline. | 1.1 |
| onRemoteTrackAvailableNotify | Callback for when a remote user's audio or video stream changes. | 1.1 |
| onFirstRemoteVideoFrameDrawn | Callback for when the first frame of a remote video stream is rendered. | 1.16.2 |
| onFirstLocalVideoFrameDrawn | This message is triggered when the first video frame starts to display in the preview. | 1.17.2 |
| onFirstVideoFrameReceived | Callback for receiving the first video frame from a remote user. | 2.1 |
| onFirstVideoPacketSent | Callback for sending the first video packet. | 2.1 |
| onFirstAudioPacketSent | Callback for sending the first audio packet. | 2.1 |
| onFirstVideoPacketReceived | Callback for receiving the first video packet. | 2.1 |
| onFirstAudioPacketReceived | Callback for receiving the first audio packet. | 2.1 |
| onFirstRemoteAudioDecoded | Callback for when the first frame of remote audio is decoded. | 2.1 |
| onBye | Callback for when you are removed from a channel by the server or the channel is closed. | 1.1 |
| onAliRtcStats | Callback for current session statistics. | 1.16 |
| onUserAudioMuted | Notification that a remote user has stopped sending audio data. | 1.16.3 |
| onUserVideoMuted | Notification that a remote user is sending black video frames. | 1.16.3 |
| onUserVideoEnabled | Notification that a remote user has disabled camera stream capture. | 2.1 |
| onUserAudioInterruptedBegin | Notification that a user's audio is interrupted. | 1.17 |
| onUserAudioInterruptedEnded | Notification that a user's audio interruption has ended. | 1.17 |
| onUserWillResignActive | A remote user's application has moved to the background. | 1.17 |
| onUserWillBecomeActive | A remote user's application has returned to the foreground. | 1.17 |
| onAudioPlayingStateChanged | Callback for local audio accompaniment playback. | 1.16.2 |
| onRemoteAudioAccompanyStarted | A remote user's audio accompaniment has started playing. | 2.1 |
| onRemoteAudioAccompanyFinished | A remote user's audio accompaniment has finished playing. | 2.1 |
| onAudioEffectFinished | Callback for when a local sound effect finishes playing. | 1.17.30 |
| onMediaRecordEvent | Recording event callback. | 1.17 |
| onRtcLocalVideoStats | Callback for local video statistics. | 1.17 |
| onRtcRemoteVideoStats | Callback for remote video statistics. | 1.17 |
| onRtcRemoteAudioStats | Remote audio statistics. | 2.1 |
| onRtcLocalAudioStats | Local audio statistics. | 2.1 |
| onMediaExtensionMsgReceived | Callback for receiving media extension messages. | 1.17.1 |
| onUplinkChannelMessage | Notification of the result of sending a message from the client to the server. | 2.1 |
| onAudioFocusChange | Callback for the result of an audio focus change. | 1.17 |
| onAudioRouteChanged | Callback for when the audio route changes. | 2.1 |
| onMessage | Signaling channel for the SaaS layer. | 2.1 |
| onChannelRelayStateChanged | Cross-channel co-streaming state changes. | 2.1 |
| onChannelRelayEvent | Cross-channel co-streaming events. | 2.1 |
| onRemoteVideoChanged | Callback for remote video stream changes. | 2.4 |
| API | Description | Minimum supported version |
| onLocalVideoSample | Subscribed local captured video data. | 1.17 |
| onRemoteVideoSample | Subscribed remote video data. | 1.17 |
| onPreEncodeVideoSample | Subscribed local pre-encoding video data. | 2.1 |
| onGetVideoFormatPreference | Video data output format. | 2.1 |
| onGetObservedFramePosition | Video data output position. | 2.1 |
| onGetIfUserFetchObserverData | Indicates whether the video output data is fetched by the user. | 2.4 |
| onGetVideoAlignment | Video data output alignment. | 2.4 |
| onGetObserverDataMirrorApplied | Indicates whether the video output data requires mirroring. | 2.4 |
| onGetSmoothRenderingEnabled | Indicates whether the pulled video stream data is output smoothly. | 2.4 |
| API | Description | Minimum supported version |
| onCaptureRawData | Local captured audio data. | 1.17 |
| onCaptureData | Local ingested audio data. | 1.17 |
| onRenderData | Local subscribed audio data. | 1.17 |
| onPlaybackAudioFrameBeforeMixing | Audio data of a specified user before mixing. | 2.1 |
| API | Description | Minimum supported version |
| onAudioVolume | Callback for user audio volume. | 1.16.2 |
| onActiveSpeaker | The current subscribed speaker. | 2.1 |
| API | Description | Minimum supported version |
| onTextureCreate | Callback for video GL texture creation. | 1.15 |
| onTextureUpdate | Callback for video GL texture updates. | 1.15 |
| onTextureDestroy | Callback for video GL texture destruction. | 1.15 |
Details
- onJoinChannelResult: Callback for the result of joining a channel.
public void onJoinChannelResult(int result, String channel, int elapsed);Parameter Type Description result int The result of joining the channel. 0 indicates success. A non-zero value indicates an error. For more information, see Error codes. channel String The channel ID. elapsed int The time elapsed to join the channel, in milliseconds. - onLiveStreamingSignalingResult: Callback for low-latency interactive stream pulling.
public void onLiveStreamingSignalingResult(int result);Parameter Type Description result int The result of pulling the live stream. 0 indicates success. A non-zero value indicates failure. - onLeaveChannelResult: Callback for the result of leaving a channel.
The SDK returns this callback after you call the leaveChannel method. If you destroy the SDK instance immediately after leaving the channel, you will not receive this callback.
public void onLeaveChannelResult(int result, AliRtcEngine.AliRtcStats stats);Parameter Type Description result int The result of leaving the channel. 0 indicates success. A non-zero value indicates an error. stats AliRtcStats A summary of data statistics for the session in the channel. - onAudioPublishStateChanged: Callback for changes in the audio stream ingest state.
public void onAudioPublishStateChanged(AliRtcEngine.AliRtcPublishState oldState , AliRtcEngine.AliRtcPublishState newState, int elapseSinceLastState, String channel);Parameter Type Description oldState AliRtcPublishState The previous ingest state. newState AliRtcPublishState The current ingest state. elapseSinceLastState int The time interval since the last state change, in milliseconds. channel String The current channel ID. - onVideoPublishStateChanged: Callback for changes in the video stream ingest state.
public void onVideoPublishStateChanged(AliRtcEngine.AliRtcPublishState oldState , AliRtcEngine.AliRtcPublishState newState, int elapseSinceLastState, String channel);Parameter Type Description oldState AliRtcPublishState The previous ingest state. newState AliRtcPublishState The current ingest state. elapseSinceLastState int The time interval since the last state change, in milliseconds. channel String The current channel ID. - onDualStreamPublishStateChanged: Callback for changes in the secondary video stream ingest state.
public void onDualStreamPublishStateChanged(AliRtcEngine.AliRtcPublishState oldState , AliRtcEngine.AliRtcPublishState newState, int elapseSinceLastState, String channel);Parameter Type Description oldState AliRtcPublishState The previous ingest state. newState AliRtcPublishState The current ingest state. elapseSinceLastState int The time interval since the last state change, in milliseconds. channel String The current channel ID. - onScreenSharePublishStateChanged: Callback for changes in the screen sharing ingest state.
public void onScreenSharePublishStateChanged(AliRtcEngine.AliRtcPublishState oldState , AliRtcEngine.AliRtcPublishState newState, int elapseSinceLastState, String channel);Parameter Type Description oldState AliRtcPublishState The previous ingest state. newState AliRtcPublishState The current ingest state. elapseSinceLastState int The time interval since the last state change, in milliseconds. channel String The current channel ID. - onAudioSubscribeStateChanged: Callback for changes in the audio subscription state.
public void onAudioSubscribeStateChanged(String uid, AliRtcEngine.AliRtcSubscribeState oldState, AliRtcEngine.AliRtcSubscribeState newState, int elapseSinceLastState, String channel);Parameter Type Description uid String The remote user ID. oldState AliRtcSubscribeState The previous subscription state. newState AliRtcSubscribeState The current subscription state. elapseSinceLastState int The time interval since the last state change, in milliseconds. channel String The current channel ID. - onVideoSubscribeStateChanged: Callback for changes in the camera stream subscription state.
public void onVideoSubscribeStateChanged(String uid, AliRtcEngine.AliRtcSubscribeState oldState, AliRtcEngine.AliRtcSubscribeState newState, int elapseSinceLastState, String channel);Parameter Type Description uid String The remote user ID. oldState AliRtcSubscribeState The previous subscription state. newState AliRtcSubscribeState The current subscription state. elapseSinceLastState int The time interval since the last state change. channel String The current channel ID. - onSubscribeStreamTypeChanged: Callback for changes in the subscribed camera stream type (high-resolution or low-resolution).
public void onSubscribeStreamTypeChanged(String uid, AliRtcEngine.AliRtcVideoStreamType oldStreamType, AliRtcEngine.AliRtcVideoStreamType newStreamType, int elapseSinceLastState, String channel);Parameter Type Description uid String The remote user ID. oldState AliRtcVideoStreamType The previous subscription state. newState AliRtcVideoStreamType The current subscription state. elapseSinceLastState int The time interval since the last state change, in milliseconds. channel String The current channel ID. - onScreenShareSubscribeStateChanged: Callback for changes in the screen sharing stream subscription state.
public void onScreenShareSubscribeStateChanged(String uid, AliRtcEngine.AliRtcSubscribeState oldState, AliRtcEngine.AliRtcSubscribeState newState, int elapseSinceLastState, String channel);Parameter Type Description uid String The remote user ID. oldState AliRtcSubscribeState The previous subscription state. newState AliRtcSubscribeState The current subscription state. elapseSinceLastState int The time interval since the last state change, in milliseconds. channel String The current channel ID. - onNetworkQualityChanged: Callback for when 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. An empty user ID indicates the local user. Other values indicate a remote user. upQuality AliRtcNetworkQuality The uplink network quality. downQuality AliRtcNetworkQuality The downlink network quality. - onNetworkQualityProbeTest: Callback for network quality probing.
public void onNetworkQualityProbeTest(AliRtcNetworkQuality quality);Parameter Type Description networkQuality AliRtcNetworkQuality The network quality. - onOccurWarning: Callback for warnings.
You can ignore warning callbacks. These warnings do not affect normal operations.
public void onOccurWarning(int warn, String message);Parameter Type Description warn int The warning type. msg String The warning description. - onOccurError: Callback for errors.Note If the error parameter is 16908812 or 33620229, first call the destroy method to destroy the instance. Then, create a new SDK instance and call the joinChannel method to join the channel.
public void onOccurError(int error, String message);Parameter Type Description error int The error type. msg String The error description. - onPerformanceLow: Callback for when the current device performance is low.
public void onPerformanceLow(); - onPerformanceRecovery: Callback for when the current device performance recovers.
public void onPermormanceRecovery(); - onConnectionLost: Callback for network disconnection.
public void onConnectionLost(); - onTryToReconnect: Callback for network reconnection attempts.
public void onTryToReconnect(); - onConnectionRecovery: Callback for successful network reconnection.
public void onConnectionRecovery(); - onConnectionStatusChange: Callback for changes in the network connection status.
public void onConnectionStatusChange(AliRtcEngine.AliRtcConnectionStatus status, AliRtcEngine.AliRtcConnectionStatusChangeReason reason);Parameter Type Description status AliRtcConnectionStatus The current network connection status. reason AliRtcConnectionStatusChangeReason The reason for the network connection status change. - onUpdateRoleNotify: Callback for 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: Callback for snapshot completion.
public void onSnapshotComplete(String userId, AliRtcVideoTrack trackType, Bitmap bitmap, boolean success);Parameter Type Description userId String The user ID. trackType AliRtcVideoTrack The video track for the snapshot. bitmap Bitmap The returned Bitmap object of the snapshot. success boolean Indicates whether the snapshot was successful. - onPublishLiveStreamStateChanged: Callback for changes in the bypass stream ingest state.
public void onPublishLiveStreamStateChanged(String streamUrl, AliRtcLiveTranscodingState state, AliEngineLiveTranscodingErrorCode errorCode);Parameter Type Description streamUrl String The ingest URL. state AliRtcLiveTranscodingState The bypass live streaming state. errorCode AliEngineLiveTranscodingErrorCode The error code. - onPublishTaskStateChanged: Callback for changes in the bypass task state.
public void onPublishTaskStateChanged(String streamUrl, AliRtcTrascodingPublishTaskStatus state);Parameter Type Description streamUrl String The ingest URL. state AliRtcTrascodingPublishTaskStatus The bypass live stream ingest task status. - onRemoteUserOnLineNotify: Callback for when a remote user goes online.
public void onRemoteUserOnLineNotify(String uid, int elapsed);Parameter Type Description uid String The remote user ID. elapsed int The time elapsed for the user to join the channel, in milliseconds. - onRemoteUserOffLineNotify: Callback for when a remote user goes offline.
public void onRemoteUserOffLineNotify(String uid, AliRtcUserOfflineReason reason);Parameter Type Description uid String The remote user ID. reason AliRtcUserOfflineReason The reason why the user went offline. - onRemoteTrackAvailableNotify: Callback for when a remote user's audio or video stream becomes available.
public void onRemoteTrackAvailableNotify(String uid, AliRtcAudioTrack audioTrack, AliRtcVideoTrack videoTrack);Parameter Type Description uid String The remote user ID. audioTrack AliRtcAudioTrack The remote user's audio stream after the change. videoTrack AliRtcVideoTrack The remote user's video stream after the change. - onFirstRemoteVideoFrameDrawn: Callback for when the first frame of a remote video stream is rendered.
public void onFirstRemoteVideoFrameDrawn(String uid,AliRtcVideoTrack videoTrack, int width, int height, int elapsed);Parameter Type Description uid String The remote user ID. videoTrack AliRtcVideoTrack The type of video stream being rendered. width int The video width. height int The video height. elapsed int The total time elapsed, in milliseconds. - onFirstLocalVideoFrameDrawn: Callback triggered when the first local video frame is displayed in the preview.
public void onFirstLocalVideoFrameDrawn(int width, int height, int elapsed);Parameter Type Description width int The video width. height int The video height. elapsed int The total time elapsed, in milliseconds. - onFirstVideoFrameReceived: Callback for when the first video frame is received from a remote user.
public void onFirstVideoFrameReceived(String uid, AliRtcVideoTrack videoTrack, int timeCost);Parameter Type Description uid String The remote user ID. videoTrack AliRtcVideoTrack The type of video stream being rendered. timeCost int The time elapsed, in milliseconds. - onFirstVideoPacketSent: Callback for when the first video packet is sent.
public void onFirstVideoPacketSent(String userId, AliRtcVideoTrack videoTrack, int timeCost);Parameter Type Description userId String The user ID. videoTrack AliRtcVideoTrack Sends a video stream. timeCost int The time elapsed, in milliseconds. - onFirstAudioPacketSent: Callback for when the first audio packet is sent.
public void onFirstAudioPacketSent(String userId, int timeCost);Parameter Type Description userId String The user ID. timeCost int The time elapsed, in milliseconds. - onFirstVideoPacketReceived: Callback for when the first video packet is received.
public void onFirstVideoPacketReceived(String userId, AliRtcVideoTrack videoTrack, int timeCost);Parameter Type Description userId String The user ID. videoTrack AliRtcVideoTrack Accepts video streams. timeCost int The time elapsed, in milliseconds. - onFirstAudioPacketReceived: Callback for when the first audio packet is received.
public void onFirstAudioPacketReceived(String userId,int timeCost);Parameter Type Description userId String The user ID. timeCost int The time elapsed, in milliseconds. - onFirstRemoteAudioDecoded: Callback for when the first frame of remote audio is decoded.
public void onFirstRemoteAudioDecoded(String uid, int timeCost);Parameter Type Description uid String The remote user ID. elapsed int The time elapsed, in milliseconds. - onBye: Callback for when you are removed from a channel by the server or when 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 The session statistics. - onUserAudioMuted: Callback that notifies you when a remote user stops sending an audio stream.
public void onUserAudioMuted(String uid ,boolean isMute);Parameter Type Description uid String The user who performed the muteAudio action. isMute boolean Indicates whether the user is muted. Valid values: - true: Muted.
- false: Unmuted.
- onUserVideoMuted: Callback that notifies you when a remote user stops sending a video stream. When this occurs, black video frames are sent.
public void onUserVideoMuted(String uid ,boolean isMute);Parameter Type Description uid String The user who performed the enableLocalVideo action. isMute boolean Indicates whether to send black frames. Valid values: - true: Ingests black frames.
- false: Ingests normally.
- onUserVideoEnabled: Callback that notifies you when a remote user enables or disables their camera stream capture.
public void onUserVideoEnabled(String uid, boolean isMute);Parameter Type Description uid String The remote user ID. isMute boolean Indicates whether camera stream capture is enabled. Valid values: - true: Enables camera stream capture.
- false: Disables camera stream capture.
- onUserAudioInterruptedBegin: Callback for when a user's audio is interrupted.
public void onUserAudioInterruptedBegin(String uid);Parameter Type Description uid String The user whose audio is interrupted. - onUserAudioInterruptedEnded: Callback for when a user's audio interruption ends.
public void onUserAudioInterruptedEnded(String uid);Parameter Type Description uid String The user whose audio was interrupted. - onUserWillResignActive: Callback for when a remote user's application moves to the background.
public void onUserWillResignActive(String uid);Parameter Type Description uid String The user ID. - onUserWillBecomeActive: Callback for when a remote user's application returns to the foreground.
public void onUserWillBecomeActive(String uid);Parameter Type Description uid String The user ID. - onAudioPlayingStateChanged: Callback for changes in the local audio accompaniment playback state.
public void onAudioPlayingStateChanged(AliRtcEngine.AliRtcAudioPlayingStateCode playState, AliRtcEngine.AliRtcAudioPlayingErrorCode errorCode);Parameter Type Description playState AliRtcAudioPlayingStateCode The current playback state. errorCode AliRtcAudioPlayingErrorCode The error code. - onRemoteAudioAccompanyStarted: Callback for when a remote user starts playing audio accompaniment.
public void onRemoteAudioAccompanyStarted(String uid);Parameter Type Description uid String The user ID. - onRemoteAudioAccompanyFinished: Callback for when a remote user finishes playing audio accompaniment.
public void onRemoteAudioAccompanyFinished(String uid);Parameter Type Description uid String The user ID. - onAudioEffectFinished: Callback for when a local sound effect finishes playing.
void OnAudioEffectFinished(int soundId);Parameter Type Description soundId int The ID that the user assigned to the sound effect file. - onMediaRecordEvent: Callback for recording events.
public void onMediaRecordEvent(int event, String filePath);Parameter Type Description event int The recording event. Valid values: - 0: Recording started.
- 1: Recording ended.
- 2: Failed to open the file.
- 3: Failed to write to 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 local video statistics. - 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 remote video statistics. - onRtcRemoteAudioStats: Remote audio statistics.
public void onRtcRemoteAudioStats(AliRtcEngine.RtcRemoteAudioStats aliRtcStats);The SDK triggers this statistics callback every two seconds.
Parameter Type Description aliRtcStats RtcRemoteAudioStats The remote audio statistics. - onRtcLocalAudioStats: Local audio statistics.
public void onRtcLocalAudioStats(AliRtcEngine.RtcLocalAudioStats aliRtcStats);The SDK triggers this statistics callback every two seconds.
Parameter Type Description aliRtcStats RtcLocalAudioStats The local audio statistics. - onMediaExtensionMsgReceived: Callback for when a media extension message is received.
public void onMediaExtensionMsgReceived(String uid, byte[] message);When a user in the channel sends custom data, you can receive the data through this callback.
Parameter Type Description uid String The user ID. message byte[] The received custom data. - onUplinkChannelMessage: Callback for the SaaS layer that provides the result of sending a message from the client 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: Callback that notifies you of an audio focus change.
public void onAudioFocusChange(int focusChange);The SDK manages audio focus internally. If an external source takes audio focus, you must request it again after receiving this callback from the SDK.
Parameter Type Description focusChange int The audio status. - onAudioRouteChanged: Callback for when the audio route changes.
public void onAudioRouteChanged(AliRtcEngine.AliRtcAudioRouteType routing);Parameter Type Description routing AliRtcAudioRouteType The currently used audio route. - onMessage: Callback for receiving messages from the SaaS layer signaling channel.
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: Callback for changes in the cross-channel media relay state.
public void onChannelRelayStateChanged(int state, int code, String message);Parameter Type Description state int The current co-streaming state. code int The current status code. msg String The status description. - onChannelRelayEvent: Callback for cross-channel media relay events.
public void onChannelRelayEvent(int event);Parameter Type Description event int The status code. - onRemoteVideoChanged: Callback for changes in the remote video stream.
public void onRemoteVideoChanged(String uId, AliRtcVideoTrack videoTrack, AliRtcVideoState videoState, AliRtcVideoReason videoReason);Parameter Type Description uId String The user ID. videoTrack AliRtcVideoTrack The video stream type. videoState AliRtcVideoState The change in the video stream state. videoReason AliRtcVideoReason The reason that triggered the change in the video stream state. - onLocalVideoSample: Callback that provides the captured local video data.
public boolean onLocalVideoSample(AliVideoSourceType sourceType, AliRtcVideoSample videoSample){return false;}If you return true, the data is written back to the SDK. This applies only to the I420 format.
If you return false, the data is not written back to the SDK.
Parameter Type Description sourceType AliVideoSourceType The video stream type. videoSample AliRtcVideoSample The frame data. - onRemoteVideoSample: Callback that provides the subscribed remote video data.
public boolean onRemoteVideoSample(String uid, AliVideoSourceType sourceType, AliRtcVideoSample videoSample){return false;}If you return true, the data is written back to the SDK. This applies only to the I420 format.
If you return false, the data is not written back to the SDK.
Parameter Type Description uid String The user ID. sourceType AliVideoSourceType The video stream type. videoSample AliRtcVideoSample The frame data. - onPreEncodeVideoSample: Callback that provides the local video data before encoding.
public boolean onPreEncodeVideoSample(AliVideoSourceType sourceType, AliRtcVideoSample videoRawData){return false;}If you return true, the data is written back to the SDK. This applies only to the I420 format.
If you return false, the data is not written back to the SDK.
Parameter Type Description videoSource AliVideoSourceType The video stream type. videoRawData AliRtcVideoSample The frame data. - onGetVideoFormatPreference: Callback to specify the preferred output format for video data.
public AliEngineVideoFormat onGetVideoFormatPreference() {return AliEngineVideoFormat.AliEngineVideoFormatI420;} - onGetObservedFramePosition: Callback to specify the position in the pipeline from which to output video data.
public int onGetObservedFramePosition() {return AliEngineVideoObserPosition.AliEnginePositionPostCapture.getValue() | AliEngineVideoObserPosition.AliEnginePositionPreRender.getValue();} - onGetIfUserFetchObserverData: Callback to specify whether the user fetches the video data.
Return valuepublic boolean onGetIfUserFetchObserverData(){return false;}true: The user fetches the video data. false: The SDK provides the video data through a callback. The default value is false.
- onGetVideoAlignment: Callback to specify the memory alignment for the video data output.
Return valuepublic int onGetVideoAlignment(){ return AliRtcVideoObserAlignment.AliRtcAlignmentDefault.getValue(); }Returns the data alignment for the raw data callback. The default value is AliRtcAlignmentDefault.
- onGetObserverDataMirrorApplied: Callback to specify whether mirroring is applied to the output video data.
Return valuepublic boolean onGetObserverDataMirrorApplied(){return false;}true: Mirroring is applied to the output video data. false: Mirroring is not applied to the output video data. The default value is false.
- onGetSmoothRenderingEnabled: Callback to specify whether to enable smooth rendering for the output video data.
Return valuepublic boolean onGetSmoothRenderingEnabled(){return false;}true: Smooth rendering is enabled. false: The video data is output directly. The default value is false.
Note Smooth rendering only takes effect if onGetIfUserFetchObserverData returns false. - onCaptureRawData: Callback that provides the captured raw local audio data.
void onCaptureRawData(AliRtcAudioSample aliAudioSample);Parameter Type Description aliAudioSample AliRtcAudioSample The audio data. - onCaptureData: Callback that provides the local audio data for stream ingest.
void onCaptureData(AliRtcAudioSample aliAudioSample);Parameter Type Description aliAudioSample AliRtcAudioSample The audio data. - onRenderData: Callback that provides the remote audio data for playback.
void onRenderData(AliRtcAudioSample aliAudioSample);Parameter Type Description aliAudioSample AliRtcAudioSample The audio data. - onPlaybackAudioFrameBeforeMixing: Callback that provides the audio data of a single remote user before mixing.
void onPlaybackAudioFrameBeforeMixing(String uid, AliRtcAudioSample aliAudioSample);Parameter Type Description uid String The user ID. aliAudioSample AliRtcAudioSample The audio data. - onAudioVolume: Callback that reports the volume, voice status, and user ID of subscribed users.
public void onAudioVolume(List<AliRtcEngine.AliRtcAudioVolume> speakers, int totalVolume);Parameter Type Description speakers List<AliRtcEngine.AliRtcAudioVolume> An array of user volume information, including the user ID, voice status, and volume. When the user ID is 0, it indicates the local speaker.
totalVolume int The total volume after mixing. The range is [0, 255]. In the local user's callback, totalVolume is the volume of the local user after mixing. In a remote user's callback, totalVolume is the total volume of all speakers after mixing.
- onActiveSpeaker: Callback that reports the currently active speaker.
public void OnActiveSpeaker(String uid);Parameter Type Description uid String The speaker's user ID. When the user ID is 0, it indicates the local speaker. This returns the ID of the user with the loudest voice over the current time period, not the user with the loudest instantaneous voice. - onTextureCreate: Callback for when a video GL texture is created.
void onTextureCreate(long context);Parameter Type Description context long The OpenGL thread-related context variable. - onTextureUpdate: Callback for when a video GL texture is updated.
int onTextureUpdate(int textureId, int width, int height, AliRtcVideoSample videoSample);Parameter Type Description textureId int The ID of the video data texture type. width int The width. height int The height. videoSample AliRtcVideoSample The video data. - onTextureDestroy: Callback for when a video GL texture is destroyed.
void onTextureDestroy();