ZegoAudioRoomDelegate Protocol Reference

Conforms to NSObject
Declared in ZegoAudioRoomApi.h

– onKickOut:roomID:

用户被踢出聊天室

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

Parameters

reason

原因

roomID

房间 ID

Discussion

Warning: deprecated 请使用onKickOut:roomID:customReason

Declared In

ZegoAudioRoomApi.h

– onKickOut:roomID:customReason:

用户被踢出聊天室

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

Parameters

reason

原因

roomID

房间 ID

Discussion

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

Declared In

ZegoAudioRoomApi.h

– onDisconnect:roomID:

与 server 断开通知

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

Parameters

errorCode

错误码,0 表示无错误

roomID

房间 ID

Discussion

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

Declared In

ZegoAudioRoomApi.h

– onStreamUpdated:stream:

流更新消息,此时sdk会开始拉流/停止拉流

- (void)onStreamUpdated:(ZegoAudioStreamType)type stream:(ZegoAudioStream *)stream

Parameters

type

增加/删除流

stream

流信息

Declared In

ZegoAudioRoomApi.h

– onStreamExtraInfoUpdated:roomID:

流附加信息更新

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

Parameters

streamList

附加信息更新的流列表

roomID

房间 ID

Discussion

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

Declared In

ZegoAudioRoomApi.h

– onUserUpdate:updateType:

房间成员更新回调

- (void)onUserUpdate:(NSArray<ZegoUserState*> *)userList updateType:(ZegoUserUpdateType)type

Parameters

userList

成员更新列表

type

更新类型(增量,全量)

Discussion

当房间成员变化(例如用户进入、退出房间)时,会触发此通知

Declared In

ZegoAudioRoomApi.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

调用 [ZegoLiveRoomApi -sendCustomCommand:content:completion:] 发送自定义消息后,消息列表中的用户会收到此通知

Declared In

ZegoAudioRoomApi.h