本章节为您介绍了Unity SDK回调及监听的接口详情。
目录
IAliRtcEngine回调如下所示。
API | 描述 | 以上版本支持 |
---|---|---|
OnJoinChannelNotify | 入会结果回调 | 1.15 |
OnPublishNotify | 推流结果回调 | 1.15 |
OnSubscribeNotify | 订阅结果回调 | 1.15 |
OnRemoteUserOnLineNotify | 远端用户上线回调 | 1.15 |
OnRemoteUserOffLineNotify | 远端用户下线回调 | 1.15 |
OnRemoteTrackAvailableNotify | 远端用户音视频流发生变化时回调 | 1.15 |
OnSubscribeChangedNotify | 订阅变化回调 | 1.15 |
OnNetworkQualityChangedNotify | 网络质量变化回调 | 1.15 |
OnConnectionLostNotify | 网络连接断开回调 | 1.15 |
OnTryToReconnectNotify | 网络连接正在尝试重连中回调 | 1.15 |
OnConnectionRecoveryNotify | 网络连接重连成功回调 | 1.15 |
OnByeNotify | 被服务器踢出或者频道关闭时回调 | 1.15 |
OnOccurWarningNotify | 警告回调 | 1.15 |
OnOccurErrorNotify | 错误回调 | 1.15 |
OnLeaveChannelResultNotify | 离开频道结果回调 | 1.15 |
OnUpdateRoleNotify | 用户角色发生变化化时通知 | 1.15 |
接口详情
-
OnJoinChannelNotify:入会结果回调。
public delegate void OnJoinChannelNotifyHandler(int errorCode);
参数 类型 描述 errorCode int 错误码,0表示成功 -
OnPublishNotify:推流结果回调。
public delegate void OnPublishNotifyHandler(int errorCode);
参数 类型 描述 errorCode int 错误码,0表示成功 -
OnSubscribeNotify:订阅结果回调。
public delegate void OnSubscribeNotifyHandler(string userId, int videoTrack, int audioTrack);
参数 类型 描述 userId string 远端用户ID videoTrack int 订阅成功的视频流 audioTrack int 订阅成功的音频流 -
OnRemoteUserOnLineNotify:远端用户上线回调。
public delegate void OnRemoteUserOnLineNotifyHandler(string userId);
参数 类型 描述 userId string 远端用户ID -
OnRemoteUserOffLineNotify:远端用户下线回调。
public delegate void OnRemoteUserOffLineNotifyHandler(string userId);
参数 类型 描述 userId string 远端用户ID -
OnRemoteTrackAvailableNotify:远端用户音视频流发生变化时回调。
public delegate void OnRemoteTrackAvailableNotifyHandler(string userId, int audioTrack, int videoTrack);
参数 类型 描述 userId string 远端用户ID videoTrack int 订阅成功的视频流 audioTrack int 订阅成功的音频流 -
OnSubscribeChangedNotify:订阅变化回调。
public delegate void OnSubscribeChangedNotifyHandler(string userId, int audioTrack, int videoTrack);
参数 类型 描述 userId string 远端用户ID videoTrack int 远端用户发生变化后的视频流 audioTrack int 远端用户发生变化后的音频流 -
OnNetworkQualityChangedNotify:网络质量变化回调。
public delegate void OnNetworkQualityChangedNotifyHandler(string userId, int upQuality, int downQuality);
参数 类型 描述 userId string 网络质量发生变化的用户ID,用户ID为空表示本地,其他表示远端 upQuality int 上行网络质量 downQuality int 下行网络质量 -
OnConnectionLostNotify:网络连接断开回调。
public delegate void OnConnectionLostNotifyHandler();
-
OnTryToReconnectNotify:网络连接正在尝试重连中回调。
public delegate void OnTryToReconnectNotifyHandler();
-
OnConnectionRecoveryNotify:网络连接重连成功回调。
public delegate void OnConnectionRecoveryNotifyHandler();
-
OnByeNotify:被服务器踢出或者频道关闭时回调。
public delegate void OnByeNotifyHandler(int code);
参数 类型 描述 code int 消息类型 - 1:被服务器踢出
- 2:频道关闭
- 3:同一个用户ID在其他端登录,被服务器踢出
-
OnOccurWarningNotify:警告回调。
public delegate void OnOccurWarningNotifyHandler(int code);
参数 类型 描述 code int 警告类型 -
OnOccurErrorNotify:错误回调。
public delegate void OnOccurErrorNotifyHandler(int error);
参数 类型 描述 code int 错误类型 -
OnLeaveChannelResultNotify:离开频道结果回调。
public delegate void OnLeaveChannelResultHandler(int result);
参数 类型 描述 result int 成功返回0,失败返回错误码 -
OnUpdateRoleNotify:用户角色发生变化化时通知。
public delegate void OnUpdateRoleNotifyHandler(int oldRole, int newRole);
参数 类型 描述 oldRole int 变化前角色类型 newRole int 变化前后类型
在文档使用中是否遇到以下问题
更多建议
匿名提交