IAgoraMediaRtcRecorderEventHandler 类

  • Java

更新时间不可用

用于接收媒体录制器的回调事件。

onConnected

Java
default void onConnected(String channelId, String userId)

SDK 与声网频道连接成功时触发的回调。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString用户 ID。
表格内容超出当前宽度,可横向滚动查看更多列。

onDisconnected

Java
default void onDisconnected(String channelId, String userId, Constants.ConnectionChangedReasonType reason)

CONNECTION_STATE_DISCONNECTED(1) 状态时触发的回调。

当 SDK 与声网频道的连接状态变为 CONNECTION_STATE_DISCONNECTED(1) 时触发该回调。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString用户 ID。
reasonConstants.ConnectionChangedReasonType连接状态变化的原因,详见 ConnectionChangedReasonType。
表格内容超出当前宽度,可横向滚动查看更多列。

onReconnected

Java
default void onReconnected(String channelId, String userId, Constants.ConnectionChangedReasonType reason)

CONNECTION_STATE_CONNECTED(3) 状态恢复时触发的回调。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString用户 ID。
reasonConstants.ConnectionChangedReasonType连接状态变化的原因。详见 ConnectionChangedReasonType。
表格内容超出当前宽度,可横向滚动查看更多列。

onConnectionLost

Java
default void onConnectionLost(String channelId, String userId)

SDK 与声网频道失去连接时触发的回调。

参数

参数数据类型描述
channelIdString频道的 ID。
userIdString用户的 ID。
表格内容超出当前宽度,可横向滚动查看更多列。

onUserJoined

Java
default void onUserJoined(String channelId, String userId)

远端用户加入频道回调。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString用户 ID。
表格内容超出当前宽度,可横向滚动查看更多列。

onUserLeft

Java
default void onUserLeft(String channelId, String userId, Constants.UserOfflineReasonType reason)

onUserLeft 回调:远端用户离开频道时触发。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString用户 ID。
reasonConstants.UserOfflineReasonType远端用户离开频道的原因。详见 UserOfflineReasonType。
表格内容超出当前宽度,可横向滚动查看更多列。

onFirstRemoteVideoDecoded

Java
default void onFirstRemoteVideoDecoded(String channelId, String userId, int width, int height, int elapsed)

首帧远端视频解码完成回调。

该回调在 SDK 为录制端成功解码远端用户的首帧视频时触发。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString远端用户 ID。
widthint视频流的宽度(像素)。
heightint视频流的高度(像素)。
elapsedint从用户加入频道到触发该回调的时间(毫秒)。
表格内容超出当前宽度,可横向滚动查看更多列。

onFirstRemoteAudioDecoded

Java
default void onFirstRemoteAudioDecoded(String channelId, String userId, int elapsed)

远端音频首帧解码回调。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString发送音频流的远端用户的用户 ID。
elapsedint从远端用户加入频道到触发该回调的时间(毫秒)。
表格内容超出当前宽度,可横向滚动查看更多列。

onAudioVolumeIndication

Java
default void onAudioVolumeIndication(String channelId, SpeakVolumeInfo[] speakers, int speakerNumber)

onAudioVolumeIndication 回调:报告哪些用户正在说话、说话者的音量以及本地用户是否在说话。

参数

参数数据类型描述
channelIdString频道 ID。
speakersSpeakVolumeInfo[]说话者的用户 ID 和音量信息数组。详见 SpeakVolumeInfo。
speakerNumberint说话者的总人数。
表格内容超出当前宽度,可横向滚动查看更多列。

onActiveSpeaker

Java
default void onActiveSpeaker(String channelId, String userId)

检测到活跃发言人时触发的回调。

你可以在 App 中添加相关功能,例如当检测到活跃发言人时,将其头像放大显示。活跃发言人是指在一段时间内以最大音量发言的用户,其用户 ID 会通过该回调返回。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString活跃发言人的用户 ID。userId 为 0 表示本地用户。
表格内容超出当前宽度,可横向滚动查看更多列。

onUserVideoStateChanged

Java
default void onUserVideoStateChanged(String channelId, String userId, Constants.RemoteVideoState state, Constants.RemoteVideoStateReason reason, int elapsed)

远端视频状态发生改变回调。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString远端用户 ID,其视频状态发生了变化。
stateConstants.RemoteVideoState当前的视频状态,详见 RemoteVideoState。
reasonConstants.RemoteVideoStateReason状态变化的原因,详见 RemoteVideoStateReason。
elapsedint从该用户加入频道到触发该回调的时间(毫秒)。
表格内容超出当前宽度,可横向滚动查看更多列。

onUserAudioStateChanged

Java
default void onUserAudioStateChanged(String channelId, String userId, Constants.RemoteAudioState state, Constants.RemoteAudioStateReason reason, int elapsed)

远端用户音频状态发生变化回调。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString音频状态发生变化的远端用户 ID。
stateConstants.RemoteAudioState当前的音频状态,详见 RemoteAudioState。
reasonConstants.RemoteAudioStateReason状态变化的原因,详见 RemoteAudioStateReason。
elapsedint从该用户加入声网频道到触发该回调的时间(毫秒)。
表格内容超出当前宽度,可横向滚动查看更多列。

onRemoteVideoStats

Java
default void onRemoteVideoStats(String channelId, String userId, RemoteVideoStatistics stats)

远端视频统计信息回调。

该回调在接收到远端视频流并统计完成后被触发。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString远端用户的 ID。
statsRemoteVideoStatistics远端视频的统计信息。详见 RemoteVideoStatistics。
表格内容超出当前宽度,可横向滚动查看更多列。

onRemoteAudioStats

Java
default void onRemoteAudioStats(String channelId, String userId, RemoteAudioStatistics stats)

远端音频统计信息回调。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString远端用户的 ID。
statsRemoteAudioStatistics远端音频的统计信息。详见 RemoteAudioStatistics。
表格内容超出当前宽度,可横向滚动查看更多列。

onRecorderStateChanged

Java
default void onRecorderStateChanged(String channelId, String userId, Constants.RecorderState state, Constants.RecorderReasonCode reason, String fileName)

本地音视频录制状态发生变化回调。

该回调用于报告当前的录制状态及其变化原因。

参数

参数数据类型描述
channelIdString频道名。
userIdString用户 ID。
stateConstants.RecorderState当前录制状态,详见 RecorderState。
reasonConstants.RecorderReasonCode状态变化的原因,详见 RecorderReasonCode。
fileNameString录制流的文件名。
表格内容超出当前宽度,可横向滚动查看更多列。

onRecorderInfoUpdated

Java
default void onRecorderInfoUpdated(String channelId, String userId, RecorderInfo info)

录制信息更新回调。

在你成功注册该回调并启用本地音视频录制后,SDK 会根据设置的 recorderInfoUpdateInterval 值周期性地触发该回调。

参数

参数数据类型描述
channelIdString频道名。
userIdString用户 ID。
infoRecorderInfo录制文件的信息,详见 RecorderInfo。
表格内容超出当前宽度,可横向滚动查看更多列。

onEncryptionError

Java
default void onEncryptionError(String channelId, Constants.EncryptionErrorType errorType)

加密错误发生时触发的回调。

参数

参数数据类型描述
channelIdString频道 ID。
errorTypeConstants.EncryptionErrorType加密错误类型。详见 EncryptionErrorType。
表格内容超出当前宽度,可横向滚动查看更多列。

onError

Java
default void onError(String channelId, Constants.ErrorCodeType error, String message)

错误回调。

该回调用于报告错误码和错误信息。

参数

参数数据类型描述
channelIdString频道 ID。
errorConstants.ErrorCodeType错误码。详见 ErrorCodeType。
messageString错误信息。
表格内容超出当前宽度,可横向滚动查看更多列。

onTokenPrivilegeWillExpire

Java
default void onTokenPrivilegeWillExpire(String channelId, String token)

Token 权限即将在 30 秒后过期时触发的回调。

收到该回调后,你必须在服务器上生成新的 Token,并调用 renewToken 方法更新 Token。

参数

参数数据类型描述
channelIdString频道 ID。
tokenString即将在 30 秒后过期的 Token。
表格内容超出当前宽度,可横向滚动查看更多列。

onTokenPrivilegeDidExpire

Java
default void onTokenPrivilegeDidExpire(String channelId)

Token 过期回调。

收到该回调后,你必须在你的服务器上生成一个新的 Token,并调用 renewToken 方法进行更新。

参数

参数数据类型描述
channelIdString频道 ID。
表格内容超出当前宽度,可横向滚动查看更多列。

onVideoSizeChanged

Java
default void onVideoSizeChanged(String channelId, String userId, int width, int height, int rotation)

远端视频尺寸发生变化回调。

参数

参数数据类型描述
channelIdString频道 ID。
userIdString远端用户 ID。
widthint视频流的宽度。
heightint视频流的高度。
rotationint视频流的旋转角度。
表格内容超出当前宽度,可横向滚动查看更多列。