IAgoraMediaRtcRecorderEventHandler 类
onConnected
Java
default void onConnected(String channelId, String userId)
SDK 与声网频道连接状态变为 CONNECTION_STATE_CONNECTED(3)
时触发的回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 用户 ID。 |
onDisconnected
Java
default void onDisconnected(String channelId, String userId, Constants.ConnectionChangedReasonType reason)
连接状态变为 CONNECTION_STATE_DISCONNECTED(1)
时触发的回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 用户 ID。 |
reason | Constants.ConnectionChangedReasonType | 连接状态变化的原因。详见 ConnectionChangedReasonType 。 |
onReconnected
Java
default void onReconnected(String channelId, String userId, Constants.ConnectionChangedReasonType reason)
连接状态恢复为 CONNECTION_STATE_CONNECTED(3)
时触发的回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 用户 ID。 |
reason | Constants.ConnectionChangedReasonType | 连接状态变化的原因,详见 ConnectionChangedReasonType 。 |
onConnectionLost
Java
default void onConnectionLost(String channelId, String userId)
SDK 与声网频道失去连接时触发的回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道的 ID。 |
userId | String | 用户的 ID。 |
onUserJoined
Java
default void onUserJoined(String channelId, String userId)
远端用户加入频道回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道的 ID。 |
userId | String | 远端用户的 ID。 |
onUserLeft
Java
default void onUserLeft(String channelId, String userId, Constants.UserOfflineReasonType reason)
远端用户离开频道回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 远端用户 ID。 |
reason | Constants.UserOfflineReasonType | 远端用户离开频道的原因,详见 UserOfflineReasonType 。 |
onFirstRemoteVideoDecoded
Java
default void onFirstRemoteVideoDecoded(String channelId, String userId, int width, int height, int elapsed)
首帧远端视频解码完成回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 远端用户 ID。 |
width | int | 视频流的宽度(单位为像素)。 |
height | int | 视频流的高度(单位为像素)。 |
elapsed | int | 从远端用户加入频道到触发该回调的时间(单位为毫秒)。 |
onFirstRemoteAudioDecoded
Java
default void onFirstRemoteAudioDecoded(String channelId, String userId, int elapsed)
首帧远端音频解码回调。
该回调在 SDK 成功解码远端用户的首帧音频时被触发。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 发送音频流的远端用户的用户 ID。 |
elapsed | int | 从远端用户加入频道到触发该回调的时间(毫秒)。 |
onAudioVolumeIndication
Java
default void onAudioVolumeIndication(String channelId, SpeakVolumeInfo[] speakers, int speakerNumber)
报告哪些用户正在说话、说话者的音量以及本地用户是否在说话。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
speakers | SpeakVolumeInfo[] | 每个说话者的用户 ID 和音量信息。详见 SpeakVolumeInfo 。 |
speakerNumber | int | 说话者的总人数。 |
onActiveSpeaker
Java
default void onActiveSpeaker(String channelId, String userId)
活跃发言人检测回调。
你可以在 App 中添加相关功能,例如在检测到活跃发言人时放大其头像。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 活跃发言人的用户 ID。userId 为 0 表示本地用户。 |
onUserVideoStateChanged
Java
default void onUserVideoStateChanged(String channelId, String userId, Constants.RemoteVideoState state,
Constants.RemoteVideoStateReason reason, int elapsed)
远端视频状态发生改变回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 远端用户 ID,该用户的视频状态发生了变化。 |
state | Constants.RemoteVideoState | 当前视频状态,详见 RemoteVideoState 。 |
reason | Constants.RemoteVideoStateReason | 视频状态变化的原因,详见 RemoteVideoStateReason 。 |
elapsed | int | 自该用户加入频道以来经过的时间(毫秒)。 |
onUserAudioStateChanged
Java
default void onUserAudioStateChanged(String channelId, String userId, Constants.RemoteAudioState state,
Constants.RemoteAudioStateReason reason, int elapsed)
远端用户音频状态发生变化回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 音频状态发生变化的远端用户 ID。 |
state | Constants.RemoteAudioState | 当前的音频状态,详见 RemoteAudioState 。 |
reason | Constants.RemoteAudioStateReason | 音频状态变化的原因,详见 RemoteAudioStateReason 。 |
elapsed | int | 从该用户加入频道到触发该回调的时间(毫秒)。 |
onRemoteVideoStats
Java
default void onRemoteVideoStats(String channelId, String userId, RemoteVideoStatistics stats)
远端视频统计信息回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 远端用户的 ID。 |
stats | RemoteVideoStatistics | 远端视频的统计信息。详见 RemoteVideoStatistics 。 |
onRemoteAudioStats
Java
default void onRemoteAudioStats(String channelId, String userId, RemoteAudioStatistics stats)
远端音频统计信息回调。
该回调在收到远端用户的音频统计信息时被触发。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
userId | String | 远端用户的 ID。 |
stats | RemoteAudioStatistics | 远端音频的统计信息。详见 RemoteAudioStatistics 。 |
onRecorderStateChanged
Java
default void onRecorderStateChanged(String channelId, String userId, Constants.RecorderState state,
Constants.RecorderReasonCode reason, String fileName)
本地录制状态发生变化时的回调。
当本地音视频录制状态发生变化时,SDK 会触发该回调,报告当前的录制状态以及状态变化的原因。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道名。 |
userId | String | 用户 ID。 |
state | Constants.RecorderState | 当前的录制状态,详见 RecorderState 。 |
reason | Constants.RecorderReasonCode | 状态变化的原因,详见 RecorderReasonCode 。 |
filename | String | 录制流对应的文件名。 |
onRecorderInfoUpdated
Java
default void onRecorderInfoUpdated(String channelId, String userId, RecorderInfo info)
录制信息更新回调。
在你成功注册该回调并启用本地音视频录制后,SDK 会根据设置的 recorderInfoUpdateInterval
值定期触发该回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道名。 |
userId | String | 用户 ID。 |
info | RecorderInfo | 录制文件的信息,详见 RecorderInfo 。 |
onEncryptionError
Java
default void onEncryptionError(String channelId, Constants.EncryptionErrorType errorType)
加密错误发生时的回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
errorType | Constants.EncryptionErrorType | 加密错误类型。详见 EncryptionErrorType 。 |
onError
Java
default void onError(String channelId, Constants.ErrorCodeType error, String message)
错误信息回调。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
error | Constants.ErrorCodeType | 错误码。详见 ErrorCodeType 。 |
message | String | 错误信息。 |
onTokenPrivilegeWillExpire
Java
default void onTokenPrivilegeWillExpire(String channelId, String token)
权限即将在 30 秒后过期时触发的回调。
注意
收到该回调后,你必须在服务器上生成新的 ,并调用 renewToken
方法进行更新。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |
token | String | 即将在 30 秒后过期的 。 |
onTokenPrivilegeDidExpire
Java
default void onTokenPrivilegeDidExpire(String channelId)
过期回调。
注意
收到该回调后,你必须在服务器上生成新的 ,并调用 renewToken
方法进行更新。
参数
参数 | 数据类型 | 描述 |
---|---|---|
channelId | String | 频道 ID。 |