ZegoLivePlayerDelegate Protocol Reference

Conforms to NSObject
Declared in ZegoLiveRoomApi-Player.h

– onPlayStateUpdate:streamID: required method

播放流事件

- (void)onPlayStateUpdate:(int)stateCode streamID:(NSString *)streamID

Parameters

stateCode

播放状态码,0 表示拉流成功

streamID

流 ID

Discussion

观众调用 [ZegoLiveRoomApi (Player) -startPlayingStream:inView:] 或 [ZegoLiveRoomApi (Player) -startPlayingStream:inView:params:] 拉流成功后,通过该 API 通知

Note: 拉流状态码,详见 enum ZegoErrorCode

Declared In

ZegoLiveRoomApi-Player.h

– onInviteJoinLiveRequest:fromUserID:fromUserName:roomID:

收到主播端的邀请连麦请求

- (void)onInviteJoinLiveRequest:(int)seq fromUserID:(NSString *)userId fromUserName:(NSString *)userName roomID:(NSString *)roomID

Parameters

seq

连麦请求序列号,标识当次连麦请求

userId

来源用户 ID

userName

来源用户名

roomID

房间 ID

Discussion

主播端调用 [ZegoLiveRoomApi (Publisher) -inviteJoinLive:responseBlock:] 邀请观众连麦后,观众端会收到此通知。建议在此通知中,调用 [ZegoLiveRoomApi (Player) -respondInviteJoinLiveReq:result:] 回应邀请连麦请求

Declared In

ZegoLiveRoomApi-Player.h

– onEndJoinLiveCommad:userName:roomID:

收到结束连麦信令

- (void)onEndJoinLiveCommad:(NSString *)fromUserId userName:(NSString *)fromUserName roomID:(NSString *)roomID

Parameters

fromUserId

来源用户 ID

fromUserName

来源用户名

roomID

房间 ID

Declared In

ZegoLiveRoomApi-Player.h

– onVideoSizeChangedTo:ofStream:

视频宽高变化通知

- (void)onVideoSizeChangedTo:(CGSize)size ofStream:(NSString *)streamID

Parameters

size

视频大小

streamID

流的唯一标识

Discussion

startPlay 后,以下情况下,播放端会收到该通知:1. SDK 在获取到第一帧数据后 2. 直播过程中视频宽高发生变化。从播放第一条流,到获得第一帧数据,中间可能出现一个短暂的时间差(具体时长取决于当前的网络状态),推荐在进入直播页面时加载一张预览图以提升用户体验,然后在本回调中去掉预览图

Declared In

ZegoLiveRoomApi-Player.h

– onRemoteCameraStatusUpdate:ofStream:reason:

远端摄像头状态通知

- (void)onRemoteCameraStatusUpdate:(int)status ofStream:(NSString *)streamID reason:(int)reason

Parameters

status

参考 zego-api-defines-oc.h 中 ZegoAPIDeviceStatus 的定义

streamID

流的唯一标识

reason

参考 zego-api-defines-oc.h 中 ZegoAPIDeviceErrorReason 的定义

Declared In

ZegoLiveRoomApi-Player.h

– onRemoteMicStatusUpdate:ofStream:reason:

远端麦克风状态通知

- (void)onRemoteMicStatusUpdate:(int)status ofStream:(NSString *)streamID reason:(int)reason

Parameters

status

参考 zego-api-defines-oc.h 中 ZegoAPIDeviceStatus 的定义

streamID

流的唯一标识

reason

参考 zego-api-defines-oc.h 中 ZegoAPIDeviceErrorReason 的定义

Declared In

ZegoLiveRoomApi-Player.h

– onRecvRemoteAudioFirstFrame:

接收到远端音频的首帧通知

- (void)onRecvRemoteAudioFirstFrame:(NSString *)streamID

Parameters

streamID

流的唯一标识

Declared In

ZegoLiveRoomApi-Player.h

– onRecvRemoteVideoFirstFrame:

接收到远端视频的首帧通知

- (void)onRecvRemoteVideoFirstFrame:(NSString *)streamID

Parameters

streamID

流的唯一标识

Declared In

ZegoLiveRoomApi-Player.h

– onRenderRemoteVideoFirstFrame:

远端视频渲染首帧通知

- (void)onRenderRemoteVideoFirstFrame:(NSString *)streamID

Parameters

streamID

流的唯一标识

Declared In

ZegoLiveRoomApi-Player.h

– onPlayQualityUpdate:stream:videoFPS:videoBitrate:

观看质量更新

- (void)onPlayQualityUpdate:(int)quality stream:(NSString *)streamID videoFPS:(double)fps videoBitrate:(double)kbs

Parameters

quality

0 ~ 3 分别对应优、良、中、差

streamID

观看流ID

fps

帧率(frame rate)

kbs

码率(bit rate) kb/s

Discussion

startPlay 后,该回调会被多次调用,调用周期取决于 [ZegoLiveRoomApi (Player) setPlayQualityMonitorCycle] 设置的周期。开发者可以在该回调中获取当前的视频质量数据,加以处理

Declared In

ZegoLiveRoomApi-Player.h

– onPlayQualityUpate:quality:

观看质量更新

- (void)onPlayQualityUpate:(NSString *)streamID quality:(ZegoApiPlayQuality)quality

Parameters

streamID

观看流ID

quality

quality 参考ZegoApiPlayQuality定义

Declared In

ZegoLiveRoomApi-Player.h