|
void | onJoinChannelSuccess (int connId, int uid, int elapsed_ms) |
|
void | onConnectionLost (int connId) |
|
void | onRejoinChannelSuccess (int connId, int uid, int elapsed_ms) |
|
void | onLicenseValidationFailure (int connId, int error) |
|
void | onError (int connId, int code, String msg) |
|
void | onUserJoined (int connId, int uid, int elapsed_ms) |
|
void | onUserOffline (int connId, int uid, int reason) |
|
void | onUserMuteAudio (int connId, int uid, boolean muted) |
|
void | onUserMuteVideo (int connId, int uid, boolean muted) |
|
void | onKeyFrameGenReq (int connId, int requested_uid, int stream_type) |
|
void | onAudioData (int connId, int uid, int sent_ts, byte[] data, AudioFrameInfo info) |
|
void | onMixedAudioData (int connId, byte[] data, AudioFrameInfo info) |
|
void | onVideoData (int connId, int uid, int sent_ts, byte[] data, VideoFrameInfo info) |
|
void | onTargetBitrateChanged (int connId, int target_bps) |
|
void | onTokenPrivilegeWillExpire (int connId, String token) |
|
AgoraRtcEvents 接口类用于 SDK 向 App 发送回调事件通知,App 通过继承该接口类的方法获取 SDK 的事件通知。
◆ onAudioData()
void io.agora.rtc.AgoraRtcEvents.onAudioData |
( |
int |
connId, |
|
|
int |
uid, |
|
|
int |
sent_ts, |
|
|
byte[] |
data, |
|
|
AudioFrameInfo |
info |
|
) |
| |
收到频道内远端用户的音频帧回调。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
uid | 发送音频帧的远端用户的用户 ID。 |
sent_ts | Unix 时间戳(ms),标识发送音频帧的远端用户调用 sendAudioData 方法的时间。 |
data | 音频包数据。 |
info | 音频帧信息。 |
◆ onConnectionLost()
void io.agora.rtc.AgoraRtcEvents.onConnectionLost |
( |
int |
connId | ) |
|
连接丢失回调。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
◆ onError()
void io.agora.rtc.AgoraRtcEvents.onError |
( |
int |
connId, |
|
|
int |
code, |
|
|
String |
msg |
|
) |
| |
发生警告回调。
该回调方法表示 SDK 运行时出现了(网络或媒体相关的)警告。通常情况下,SDK 上报的警告信息 App 可以忽略,SDK 会自动恢复。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
code | 警告码。 |
msg | 警告描述。 |
◆ onJoinChannelSuccess()
void io.agora.rtc.AgoraRtcEvents.onJoinChannelSuccess |
( |
int |
connId, |
|
|
int |
uid, |
|
|
int |
elapsed_ms |
|
) |
| |
成功加入频道回调。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
uid | 用户名。 |
elapsed_ms | 从频道成功创建开始到发生此回调过去的时间(毫秒)。 |
◆ onKeyFrameGenReq()
void io.agora.rtc.AgoraRtcEvents.onKeyFrameGenReq |
( |
int |
connId, |
|
|
int |
requested_uid, |
|
|
int |
stream_type |
|
) |
| |
频道内远端用户请求关键帧回调。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
requested_uid | 远端用户的用户 ID。 |
stream_type | 需要生成关键帧的视频流类型。详见 VideoStreamType。 |
◆ onLicenseValidationFailure()
void io.agora.rtc.AgoraRtcEvents.onLicenseValidationFailure |
( |
int |
connId, |
|
|
int |
error |
|
) |
| |
设备 License 验证失败回调。
加入频道时,声网服务器会验证你在 init 中传入的 License。如果 License 验证失败,则 SDK 会触发该回调,你可以根据收到的错误码处理问题。
- 参数
-
◆ onMixedAudioData()
void io.agora.rtc.AgoraRtcEvents.onMixedAudioData |
( |
int |
connId, |
|
|
byte[] |
data, |
|
|
AudioFrameInfo |
info |
|
) |
| |
收到频道内本地用户和远端用户的混音数据回调。此回调每 20 ms 触发一次。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
data | 音频包数据。 |
info | 音频帧信息。 |
◆ onRejoinChannelSuccess()
void io.agora.rtc.AgoraRtcEvents.onRejoinChannelSuccess |
( |
int |
connId, |
|
|
int |
uid, |
|
|
int |
elapsed_ms |
|
) |
| |
重新成功加入频道回调。
有时候由于网络原因,客户端可能会和服务器失去连接,SDK 会进行自动重连,自动重连成功后触发此回调方法。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
uid | 用户名。 |
elapsed_ms | 从开始重连到重连成功的时间(毫秒)。 |
◆ onTargetBitrateChanged()
void io.agora.rtc.AgoraRtcEvents.onTargetBitrateChanged |
( |
int |
connId, |
|
|
int |
target_bps |
|
) |
| |
编码器码率更新通知回调。你可以使用此回调提醒 app 更新编码器码率。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
target_bps | 码率需要更新到的目标值,单位为 bps。 |
◆ onTokenPrivilegeWillExpire()
void io.agora.rtc.AgoraRtcEvents.onTokenPrivilegeWillExpire |
( |
int |
connId, |
|
|
String |
token |
|
) |
| |
Token 服务即将过期回调。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
token | 即将服务失效的 Token。 |
在调用 joinChannel 时如果指定了 Token,由于 Token 具有一定的时效,在通话过程中如果 Token 即将失效,SDK 会提前 30 秒触发该回调,提醒应用程序更新 Token。 当收到该回调时,用户需要重新在服务端生成新的 Token,然后调用 renewToken 将新生成的 Token 传给 SDK。
◆ onUserJoined()
void io.agora.rtc.AgoraRtcEvents.onUserJoined |
( |
int |
connId, |
|
|
int |
uid, |
|
|
int |
elapsed_ms |
|
) |
| |
远端用户加入频道回调。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
uid | 用户 ID。 |
elapsed_ms | 从频道成功创建开始到发生此回调过去的时间(毫秒)。 |
◆ onUserMuteAudio()
void io.agora.rtc.AgoraRtcEvents.onUserMuteAudio |
( |
int |
connId, |
|
|
int |
uid, |
|
|
boolean |
muted |
|
) |
| |
频道内远端用户暂停/恢复发送音频流回调。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
uid | 远端用户的用户 ID。 |
muted | 远端用户是否发送音频流:
-
true: 该用户暂停发送音频流;
-
false: 该用户恢复发送音频流。
|
◆ onUserMuteVideo()
void io.agora.rtc.AgoraRtcEvents.onUserMuteVideo |
( |
int |
connId, |
|
|
int |
uid, |
|
|
boolean |
muted |
|
) |
| |
频道内远端用户暂停/恢复发送视频流回调。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
uid | 远端用户的用户 ID。 |
muted | 远端用户是否发送视频流:
-
true: 该用户暂停发送视频流;
-
false: 该用户恢复发送视频流。
|
◆ onUserOffline()
void io.agora.rtc.AgoraRtcEvents.onUserOffline |
( |
int |
connId, |
|
|
int |
uid, |
|
|
int |
reason |
|
) |
| |
远端用户离开频道回调。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
uid | 离开频道的用户 ID。 |
reason | 用户离开频道原因:
-
USER_OFFLINE_QUIT (0): 远端用户主动下线。
-
USER_OFFLINE_DROPPED (1): 远端用户超时掉线。
|
◆ onVideoData()
void io.agora.rtc.AgoraRtcEvents.onVideoData |
( |
int |
connId, |
|
|
int |
uid, |
|
|
int |
sent_ts, |
|
|
byte[] |
data, |
|
|
VideoFrameInfo |
info |
|
) |
| |
收到频道内远端用户的视频帧回调。
- 参数
-
connId | Connection ID。一个 Connection 可以连接多个 RTC 频道。 |
uid | 发送视频帧的远端用户的用户 ID。 |
sent_ts | Unix 时间戳(ms)。标识发送视频帧的远端用户调用 sendVideoData 方法的时间。 |
data | 音频包数据。 |
info | 音频帧信息。 |
该接口的文档由以下文件生成: