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