human: 如何处理七牛云的实时音视频QNRTCClientEvent

gpt: [实时音视频](https://developer.qiniu.com/rtc) > API 文档 > Uniapp >QNRTCClientEvent

#  QNRTCClientEvent

最近更新时间: 2023-07-26 10:28:08

Index

Method

  * onAudioSubscribed
  * onConnectionStateChanged
  * onErrorLiveStreaming
  * onMessageReceived
  * onStartLiveStreaming
  * onStoppedLiveStreaming
  * onUpdatedLiveStreaming
  * onUserJoined
  * onUserLeft
  * onUserPublished
  * onUserReconnected
  * onUserReconnecting
  * onUserUnpublished
  * onVideoSubscribed

Method

onAudioSubscribed

  * onAudioSubscribed(params: {remoteUserID:string,trackList:[QNRemoteAudioTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11412/UniappQNRemoteAudioTrack)[]}): void
  * 当订阅 audio Track 成功时会触发此回调

Parameters

    * params: {remoteUserID:string,trackList:[QNRemoteAudioTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11412/UniappQNRemoteAudioTrack)[]} 

Returns void

onConnectionStateChanged

  * onConnectionStateChanged(params: {info:[QNConnectionDisconnectedInfo](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11387/UniappQNConnectionDisconnectedInfo),state:[QNConnectionState](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11407/UniappQNConnectionState)}): void
  * 当房间状态改变时会触发此回调

Parameters

    * params: {info:[QNConnectionDisconnectedInfo](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11387/UniappQNConnectionDisconnectedInfo),state:[QNConnectionState](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11407/UniappQNConnectionState)} 

Returns void

onErrorLiveStreaming

  * onErrorLiveStreaming(params: {info:[QNLiveStreamingErrorInfo](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11419/UniappQNLiveStreamingErrorInfo),streamID:string}): void
  * 转推任务出错时触发此回调

Parameters

    * params: {info:[QNLiveStreamingErrorInfo](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11419/UniappQNLiveStreamingErrorInfo),streamID:string} 

Returns void

onMessageReceived

  * onMessageReceived(message: [QNCustomMessage](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11424/UniappQNCustomMessage)): void
  * 当收到自定义消息时发此回调

Parameters

    * message: [QNCustomMessage](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11424/UniappQNCustomMessage)

Returns void

onStartLiveStreaming

  * onStartLiveStreaming(params: {streamID:string}): void
  * 转推任务成功创建时触发此回调

Parameters

    * params: {streamID:string} 

Returns void

onStoppedLiveStreaming

  * onStoppedLiveStreaming(params: {streamID:string}): void
  * 转推任务成功停止时触发此回调

Parameters

    * params: {streamID:string} 

Returns void

onUpdatedLiveStreaming

  * onUpdatedLiveStreaming(params: {streamID:string}): void
  * 转推任务合流布局更新时触发此回调

Parameters

    * params: {streamID:string} 

Returns void

onUserJoined

  * onUserJoined(params: {remoteUserID:string,userData:string}): void
  * 当远端用户加入房间时会触发此回调

Parameters

    * params: {remoteUserID:string,userData:string} 

Returns void

onUserLeft

  * onUserLeft(params: {remoteUserID:string}): void
  * 当远端用户离开房间时会触发此回调

Parameters

    * params: {remoteUserID:string} 

Returns void

onUserPublished

  * onUserPublished(params: {remoteUserID:string,trackList:([QNRemoteVideoTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11380/UniappQNRemoteVideoTrack) | [QNRemoteAudioTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11412/UniappQNRemoteAudioTrack))[]}): void
  * 当远端 Track 发布时会触发此回调

Parameters

    * params: {remoteUserID:string,trackList:([QNRemoteVideoTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11380/UniappQNRemoteVideoTrack) | [QNRemoteAudioTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11412/UniappQNRemoteAudioTrack))[]} 

Returns void

onUserReconnected

  * onUserReconnected(params: {remoteUserID:string}): void
  * 当远端用户重连成功时会触发此回调

Parameters

    * params: {remoteUserID:string} 

Returns void

onUserReconnecting

  * onUserReconnecting(params: {remoteUserID:string}): void
  * 当远端用户进入重连时会触发此回调

Parameters

    * params: {remoteUserID:string} 

Returns void

onUserUnpublished

  * onUserUnpublished(params: {remoteUserID:string,trackList:([QNRemoteVideoTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11380/UniappQNRemoteVideoTrack) | [QNRemoteAudioTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11412/UniappQNRemoteAudioTrack))[]}): void
  * 当远端 Track 取消发布时会触发此回调

Parameters

    * params: {remoteUserID:string,trackList:([QNRemoteVideoTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11380/UniappQNRemoteVideoTrack) | [QNRemoteAudioTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11412/UniappQNRemoteAudioTrack))[]} 

Returns void

onVideoSubscribed

  * onVideoSubscribed(params: {remoteUserID:string,trackList:[QNRemoteVideoTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11380/UniappQNRemoteVideoTrack)[]}): void
  * 当订阅 video Track 成功时会触发此回调

Parameters

    * params: {remoteUserID:string,trackList:[QNRemoteVideoTrack](https://developer.qiniu.com/rtc/11404/UniappQNRTCClientEvent/11380/UniappQNRemoteVideoTrack)[]} 

Returns void

以上内容是否对您有帮助？