ZegoRoomDelegate Protocol Reference

Conforms to NSObject
Declared in ZegoLiveRoomApi.h

– onKickOut:roomID:

用户被踢出房间

- (void)onKickOut:(int)reason roomID:(NSString *)roomID

Parameters

reason

被踢出原因

roomID

房间 ID

Discussion

Warning: Deprecated, 请使用onKickOut:roomID:customReason

Declared In

ZegoLiveRoomApi.h

– onKickOut:roomID:customReason:

用户被踢出房间

- (void)onKickOut:(int)reason roomID:(NSString *)roomID customReason:(NSString *)customReason

Parameters

reason

被踢出原因

roomID

房间 ID

Discussion

可在该回调中处理用户被踢出房间后的下一步处理(例如报错、重新登录提示等)

Declared In

ZegoLiveRoomApi.h

– onDisconnect:roomID:

与 server 断开通知

- (void)onDisconnect:(int)errorCode roomID:(NSString *)roomID

Parameters

errorCode

错误码,0 表示无错误

roomID

房间 ID

Discussion

建议开发者在此通知中进行重新登录、推/拉流、报错、友好性提示等其他恢复逻辑。与 server 断开连接后,SDK 会进行重试,重试失败抛出此错误。请注意,此时 SDK 与服务器的所有连接均会断开

Declared In

ZegoLiveRoomApi.h

– onReconnect:roomID:

与 server 重连成功通知

- (void)onReconnect:(int)errorCode roomID:(NSString *)roomID

Parameters

errorCode

错误码,0 表示无错误

roomID

房间 ID

Declared In

ZegoLiveRoomApi.h

– onTempBroken:roomID:

与 server 连接中断通知,SDK会尝试自动重连

- (void)onTempBroken:(int)errorCode roomID:(NSString *)roomID

Parameters

errorCode

错误码,0 表示无错误

roomID

房间 ID

Declared In

ZegoLiveRoomApi.h

– onStreamUpdated:streams:roomID:

流信息更新

- (void)onStreamUpdated:(int)type streams:(NSArray<ZegoStream*> *)streamList roomID:(NSString *)roomID

Parameters

type

更新类型,详见 ZegoStreamType 定义

streamList

直播流列表,列表中包含的是变更流的信息,非房间全部流信息

roomID

房间 ID

Discussion

房间内增加流、删除流,均会触发此更新。主播推流,自己不会收到此回调,房间内其他成员会收到。建议对流增加和流删除分别采取不同的处理。

Declared In

ZegoLiveRoomApi.h

– onStreamExtraInfoUpdated:roomID:

流附加信息更新

- (void)onStreamExtraInfoUpdated:(NSArray<ZegoStream*> *)streamList roomID:(NSString *)roomID

Parameters

streamList

附加信息更新的流列表

roomID

房间 ID

Discussion

主播推流成功后调用 [ZegoLiveRoomApi (Publisher) -updateStreamExtraInfo:] 更新附加信息,在此回调中通知房间内其他成员。调用 [ZegoLiveRoomApi (Publisher) -updateStreamExtraInfo:] 更新信息的调用方,不会收到此回调

Declared In

ZegoLiveRoomApi.h

– onReceiveCustomCommand:userName:content:roomID:

收到自定义信令

- (void)onReceiveCustomCommand:(NSString *)fromUserID userName:(NSString *)fromUserName content:(NSString *)content roomID:(NSString *)roomID

Parameters

fromUserID

消息来源 UserID

fromUserName

消息来源 UserName

content

消息内容

roomID

房间 ID

Discussion

  • 调用 -sendCustomCommand:content:completion: 发送自定义信令后,消息列表中的用户会触发此回调。

Declared In

ZegoLiveRoomApi.h