CloudHubSDK iOS
- Overview
- CloudHubRtcEngineKit
- CloudHubRtcEngineDelegate
- CloudHubRtcChannelKit
- CloudHubRtcChannelDelegate
- CloudHubEnumerates
- CloudHubObjects
CloudHubRtcChannelDelegate
Unless otherwise specified, delegete’s callback methods all run on the main thread
Channel Event
rtcChannel:didOccurError:withMessage:
An error callback occurred
- (void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
didOccurError:(CloudHubErrorCode)errorCode
withMessage:(NSString * _Nonnull)message;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
errorCode | CloudHubErrorCode Error code |
message | Error description |
Discussion
This callback indicates an internal error in the SDK
rtcChannel:didJoinChannelwithUid:elapsed:
Set channel scene
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
didJoinChannelwithUid:(NSString * _Nonnull)uid
elapsed:(NSInteger) elapsed;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | User ID: if uid is specified in thejoinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: method, it will return the specified ID; If not, it will return the data automatically assigned by CloudHubRtcChannelKit |
elapsed | From call joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: to happen this Event in the past time (ms) |
Discussion
This callback method indicates that the client successfully joined the specified channel, as in joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: joinSuccessBlock
callback
rtcChannel:didReJoinChannelwithUid:elapsed:
Rejoin the channel callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
didReJoinChannelwithUid:(NSString * _Nonnull)uid
elapsed:(NSInteger) elapsed;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | The joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: method specifies the uid, which returns the specified Id. If not, it will return automatically allocated by CloudHubRtcChannelKit |
elapsed | The time (ms) between the call tojoinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: and the occurrence of this Event |
Discussion
Sometimes, the client may lose the connection to the server due to network problems. The SDK automatically reconnects the client to the server. When the reconnection succeeds, the callback method is triggered
rtcChannel:didLeaveChannel:
Leave channel callback
- (void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
didLeaveChannel:(CloudHubChannelStats * _Nonnull)stats;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
stats | Statistics :See CloudHubChannelStats |
Discussion
The SDK triggers this callback when the user calls leaveChannel: to leave the channel
rtcChannel:onClientRoleChangedFrom:to:
The user role has been switched back in live broadcast scenarios
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onClientRoleChangedFrom:(CloudHubClientRole)oldRole
to:(CloudHubClientRole)newRole;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
oldRole | CloudHubClientRole The role before switching |
newRole | CloudHubClientRole The role after switching |
Discussion
In a live broadcast scenario, this callback is triggered when a local user calls setClientRole: In a live broadcast scenario, this callback is triggered when a local user calls
rtcChannel:didJoinedOfUid:properties:isHistory:fromChannel:
Remote user (communication scenario) or anchor (live broadcast scenario) joins the callback of the current channel
- (void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
didJoinedOfUid:(NSString * _Nonnull)uid
properties:(NSString * _Nullable)properties
isHistory:(BOOL)isHistory
fromChannel:(NSString* _Nonnull)srcChannel;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | If the UID is specified in joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: , the UID is returned. Otherwise, use the ID automatically assigned byCloudHubRtcChannelKit |
properties | joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: and setPropertyOfUid:tell:properties: interfaces can specify a custom attributes |
isHistory | Whether the user joined the channel before the local user |
srcChannel | When there is cross-channel media flow from other channels to this channel,This channel user will receive a rtcChannel:didJoinedOfUid:properties:isHistory:fromChannel: ,at this time srcChannel orward for the media stream source channel of the channel number, other cases the value is an empty string |
Discussion
In communication scenarios, this callback prompts a remote user to join a channel and returns the ID of the new user. If there are already other users in the channel before joining, new users will also receive a callback for those existing users joining the channel, in which case isHistory
is YES
In the live broadcast scenario, the callback prompts an anchor to join the channel and returns the ID of the anchor. If there is already an anchor in the channel before joining, the newly joined user will also receive the callback of the anchor joining the channel
This callback is triggered when:
- A remote user or anchor calls joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: to join a channel
- After a remote user joins a channel, call setClientRole: After a remote user joins a channel, call
- The remote user or anchor joins the channel again after the network is interrupted
Note:
- Anchors can each receive the callback of the new anchor joining the channel and obtain the UID of the anchor
- Viewers can also receive a callback when a new anchor joins the channel and get the UID of that anchor
rtcChannel:didOfflineOfUid:reason:
Remote user (communication scenario) or anchor (live broadcast scenario) callback when leaving the current channel
- (void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
didOfflineOfUid:(NSString * _Nonnull)uid
reason:(NSInteger)reason;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | ID of the remote user or anchor leaving the channel |
reason | The reason for the user to leave |
Discussion
A message is displayed indicating that a remote user or anchor has left the channel (or is offline). There are two reasons for the user to leave the channel, namely, normal departure and timeout disconnection (unable to communicate with the server for more than 30 seconds).
The reasons for the user to leave have the following values:
value | Describe |
---|---|
1 | The user called leaveChannel: to actively leave the channel |
2 | Timeout dropped due to not receiving packets from the other side for too long |
3 | The user is kicked off the channel |
4 | Left channel because same user ID entered channel |
5 | Kicked out all users because the server actively closed the channel |
6 | The user role is changed from anchor to viewer |
7 | Left channel for unknown reason |
8 | Cross - room passage closed voluntarily |
9 | The cross-room channel connection is disconnected |
rtcChannel:connectionChangedToState:
The network connection status has changed
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
connectionChangedToState:(CloudHubConnectionStateType)state;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
state | Current network connection status,See CloudHubConnectionStateType |
Discussion
This callback is triggered when the network connection status changes and informs the user of the current network connection status
rtcChannel:tokenPrivilegeWillExpire:
Token is about to expire callback in 30 seconds
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
tokenPrivilegeWillExpire:(NSString *_Nonnull)token;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
token | Token that is about to expire |
Discussion
If Token
is specified when calling joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: ,Since the Token
has a certain time limit,If the Token
is about to expire during a call, the SDK will trigger this callback 30 seconds in advance to remind the application to update the Token
.When the callback is received, the user needs to re-generate new Token
on the server and then call renewToken: to pass the newly generated Token
to the SDK
rtcChannelRequestToken:
Token has expired and needs to be renewed
- (void)rtcChannelRequestToken:(CloudHubRtcChannelKit * _Nonnull)channel;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
Discussion
If Token
is specified when calling joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: ,Since the Token
has a certain time limit ,If the Token
has been invalidated during the call, the SDK will trigger the callback immediately.Remind the application to update the Token
,When the callback is received, the user needs to re-generate new Token
on the server and then call renewToken: to pass the newly generated Token
to the SDK
Remote publishing of Event (only for when auto-subscription mode is turned off)
rtcChannel:onUserPublished:type:stream:
Remote users start posting audio and video callbacks
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onUserPublished:(NSString * _Nonnull)uid
type:(CloudHubMediaType)type
stream:(NSString * _Nonnull)streamId;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | User id of the posted video stream |
type | Video stream type: may be audio, video, screen sharing, etc. See CloudHubMediaType |
streamId | This is the only Id for the stream in the channel: This Id is required when using the Plus version of the Access Point to subscribe/play/set up remote streaming methods. |
Discussion
When a user in the channel publishes an audio/video stream successfully, the callback will be received locally if the automatic subscription is turned off, If you decide to watch this breast, you will need to call subscribe and receive the rtcChannel:remoteVideoStateChangedOfUid:streamId:type:state:reason: callback upon success, Local if not closed automatically subscribe to, can directly receive rtcChannel:remoteVideoStateChangedOfUid:streamId:type:state:reason: callback
rtcChannel:onUserUnPublished:type:stream:
The remote user stops publishing audio and video callbacks
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onUserUnPublished:(NSString * _Nonnull)uid
type:(CloudHubMediaType)type
stream:(NSString * _Nonnull)streamId;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | User id of the posted video stream |
type | Video stream type: may be audio, video, screen sharing, etc. SeeCloudHubMediaType |
streamId | This is the only Id for the stream in the channel: This Id is required when using the Plus version of the Access Point to subscribe/play/set up remote streaming methods. |
Discussion
When a user stops streaming audio and video, the local user will receive this callback if the automatic subscription is turned off. In this case, the unSubscribe method is not required
Audio Event
rtcChannel:firstRemoteAudioFrameOfUid:
First frame callback of remote audio received
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
firstRemoteAudioFrameOfUid:(NSString * _Nonnull)uid;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | User UID of the remote audio stream |
rtcChannel:remoteAudioStateChangedOfUid:state:reason:
The state of the remote audio stream has changed
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
remoteAudioStateChangedOfUid:(NSString * _Nonnull)uid
state:(CloudHubAudioRemoteState)state
reason:(CloudHubAudioRemoteStateReason)reason;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | User UID of the remote audio stream |
state | New audio stream state, SeeCloudHubAudioRemoteState |
reason | The reasons for the change, SeeCloudHubAudioRemoteStateReason |
Discussion
When the audio status of a remote user or anchor changes, the SDK triggers this callback to report the current remote audio flow status to the local user
(void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel reportAudioVolumeIndication:(NSArray * _Nonnull)speakers totalVolume:(NSInteger)totalVolume;
(void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel onActiveSpeaker:(NSString * _Nonnull)uid;
rtcChannel:reportAudioVolumeIndication:totalVolume:
Speaker volume prompts callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
reportAudioVolumeIndication:(NSArray * _Nonnull)speakers
totalVolume:(NSInteger)totalVolume;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
speakers | CloudHubAudioVolumeInfo array •In the local user callback, this array contains the following members: • uid ,Uid of local user;• volume totalVolume, indicates the volume of the local user after mixing;• vad ,Indicates the voice status of a local user;• channelId , which channel the current speaker is onIn the callback from the remote user, this array contains the following members: • uid , Represents the respective user ID of each speaker;• volume , Represents the volume of the speaker’s respective remix;• vad = 0, Indicates that it is invalid for remote users.• channelId , Indicates which channel the current speaker is on. If the reported Speakers array is empty, no one is speaking on the remote end at this time |
volume | Total volume (after mixing), value range: [0,255] In the local user callback, totalVolume is the volume of the local user after mixing In the callback of the remote user, totalVolume is the totalVolume of all speakers after mixing |
Discussion
This callback reports the user IDS of the highest volume users (up to three) within the channel, their volume, and whether the local user is talking
This callback is disabled by default and can be enabled using the enableAudioVolumeIndication:smooth:reportVAD: method; When enabled, the SDK will trigger this callback at the interval set in the enableAudioVolumeIndication:smooth:reportVAD: method, regardless of whether someone is talking in the channel, Each time, the user receives two independent callback messages, one containing the volume information of the local user and the other containing the volume information of all remote users. For details, see the preceding parameter description
rtcChannel:onActiveSpeaker:
Remote most active user callback detected
- (void)rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onActiveSpeaker:(NSString * _Nonnull)uid;
Parameters | Describe |
---|---|
uid | ID of the most active remote user |
Discussion
After a successful call to enableAudioVolumeIndication:smooth:reportVAD: , the SDK continuously monitors the loudest remote user and counts the number of times that user is judged to be loudest. In the current time range, the remote user whose number of times accumulates the most is the most active user.
When the number of users in the channel is greater than or equal to 2 and there are active users, the SDK triggers this callback and reports the UID of the most active user.
- The SDK does not trigger the onActiveSpeaker callback again if the most active user remains the same.
- If the most active user changes, the SDK triggers the callback again and reports the UID of the new most active user.
Remote video Event
rtcChannel:remoteVideoStateChangedOfUid:streamId:type:state:reason:
The remote video stream state has changed callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
remoteVideoStateChangedOfUid:(NSString * _Nonnull)uid
streamId:(NSString * _Nonnull)streamId
type:(CloudHubMediaType)type
state:(CloudHubVideoRemoteState)state
reason:(CloudHubVideoRemoteStateReason)reason;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | User UID of the remote video stream |
streamId | This is the only Id for the stream in the channel: This Id is required when using the Plus version of the Access Point to subscribe/play/set up remote streaming methods. |
type | Video stream type: may be audio, video, screen sharing, etc. SeeCloudHubMediaType |
state | New audio stream state, SeeCloudHubVideoRemoteState |
reason | The reasons for the change, SeeCloudHubVideoRemoteStateReason |
Discussion
When the video status of a remote user or host changes, the SDK triggers the callback to report the current remote video stream status to the local user
Each user may have multiple video streams, and each video channel has its type. StreamId is the unique identification of a video stream within the channel
rtcChannel:firstRemoteVideoFrameOfUID:streamId:type:Size:
The first frame callback of the remote video is displayed
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
firstRemoteVideoFrameOfUID:(NSString * _Nonnull)uid
streamId:(NSString * _Nonnull)streamId
type:(CloudHubMediaType)type
Size:(CGSize)size;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | User UID of the remote video stream |
streamId | This is the only Id for the stream in the channel: This Id is required when using the Plus version of the Access Point to subscribe/play/set up remote streaming methods. |
type | Video stream type: may be audio, video, screen sharing, etc. SeeCloudHubMediaType |
size | Width and height of the first video frame |
Discussion
After the first video frame is received and decoded successfully, the callback will be triggered in two cases:
- The remote user sends videos after logging in for the first time
- The remote user does not receive a video package within 15 seconds. The possible causes are as follows:
- The remote user leaves the channel
- The remote user is disconnected
rtcChannel:remoteVideoSizeChangedOfUID:streamId:type:size:
The remote video stream width and height has changed back
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
remoteVideoSizeChangedOfUID:(NSString * _Nonnull)uid
streamId:(NSString * _Nonnull)streamId
type:(CloudHubMediaType)type
size:(CGSize)size;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | User UID of the remote video stream |
streamId | This is the only Id for the stream in the channel: This Id is required when using the Plus version of the Access Point to subscribe/play/set up remote streaming methods. |
type | Video stream type: may be audio, video, screen sharing, etc. SeeCloudHubMediaType |
size | Width and height of the first video frame |
Data Statistics Event
rtcChannel:remoteAudioStats:
Callback statistics of remote audio streams during a call
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
remoteAudioStats:(CloudHubRtcRemoteAudioStats * _Nonnull)stats;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
stats | Remote audio statistics,See CloudHubRtcRemoteAudioStats |
Discussion
This callback describes the end-to-end audio flow statistics of a remote user during a call. It is triggered every 2 seconds for each remote user or anchor
If multiple users or anchors exist on the remote end, the callback will be triggered multiple times every two seconds
rtcChannel:remoteVideoStats:
Callback statistics of remote video stream during a call
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
remoteVideoStats:(CloudHubRtcRemoteVideoStats * _Nonnull)stats;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
stats | Remote video statistics, See CloudHubRtcRemoteVideoStats |
Discussion
This callback describes the end-to-end video stream statistics of a remote user during a call. It is triggered every 2 seconds for each remote user or anchor
If multiple users or anchors exist on the remote end, the callback will be triggered multiple times every two seconds
rtcChannel:onNetworkQuality:txQuality:rxQuality
Network upstream and downstream quality report
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onNetworkQuality:(NSString * _Nonnull)uid
txQuality:(CloudHubNetworkQuality)txQuality
rxQuality:(CloudHubNetworkQuality)rxQuality;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | User’s uid |
txQuality | Send quality reports, See CloudHubNetworkQuality |
rxQuality | Receive quality reports, See CloudHubNetworkQuality |
Discussion
This callback describes the statistics about media streams sent and received by a user during a call. Outbound media streams and each remote user media stream are called back separately
rtcChannel:onRtcStats:
Call statistics callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onRtcStats:(CloudHubChannelStats * _Nonnull)stats;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
stats | Statistics, See CloudHubChannelStats |
Discussion
This callback describes the comprehensive statistics of all media streams during a call. It is triggered every 2 seconds
Event for music file playback
rtcChannel:onLocalMovieStateChanged:state:errorCode:
The local user’s music file status changed
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onLocalMovieStateChanged:(NSString * _Nonnull)filepath
state:(CloudHubMovieStateCode)state
errorCode:(CloudHubMovieErrorCode)errorCode;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
filepath | The path to the file passed in when startPlayingMovie:cycle:view:paused: is called |
state | Play state, SeeCloudHubMovieStateCode |
errorCode | Error code, SeeCloudHubMovieErrorCode |
rtcChannel:onLocalMovieProgress:pos:total:
Callback of the local user’s music file playing progress
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onLocalMovieProgress:(NSString * _Nonnull)filepath
pos:(NSUInteger)pos
total:(NSUInteger)total;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
filepath | The path to the file passed in when startPlayingMovie:cycle:view:paused: is called |
pos | Playback Progress (ms) |
total | Total file length (ms) |
Local sound file playback Event
rtcChannel:onAudioEffectFinish:
Local user’s sound file playback state change callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onAudioEffectFinish:(int)soundId;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
soundId | The sound ID passed in at playEffect:filePath:loopCount:pitch:pan:gain:publish:startTimeMS:endTimeMS: |
Cross-channel media circulation
rtcChannel:MediaRelayStateChanged:error:
The cross-channel media flow status has changed callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
MediaRelayStateChanged:(CloudHubMediaRelayState)state
error:(CloudHubMediaRelayError)errorr;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
state | Current Status: See CloudHubMediaRelayStateCloudHub_RELAY_STATE_IDLE(0) : The SDK is initializingCloudHub_RELAY_STATE_CONNE CTING(1) : The SDK tries to cross channelsCloudHub_RELAY_STATE_FAILURE(2) : The anchor of the source channel successfully joined the target channelCloudHub_RELAY_STATE_FAILURE(3) : An exception occurs. For details, see the error message in code |
error | Error code sent across channel media stream: See CloudHubMediaRelayErrorCloudHub_RELAY_OK(0) :Everything is all rightRELAY_ERROR_SERVER_ERROR_R ESPONSE(1) :Server response errorCloudHub_RELAY_ERROR_SERVER _ERROR_RESPONSE(2) :No response from the serverCloudHub_RELAY_ERROR_NO_RES OURCE_AVAILABLE(3) :The SDK fails to obtain services because the server resources are limitedCloudHub_RELAY_ERROR_FAILED_ JOIN_SRC(4) :Failed to initiate cross channel forwarding media stream requestCloudHub_RELAY_ERROR_FAILED_ JOIN_DEST(5) :Failed to accept the cross channel forwarding media stream requestCloudHub_RELAY_ERROR_FAILED_ PACKET_RECEIVED_FROM_SRC(6) :The server failed to receive the media stream forwarded across channelsCloudHub_RELAY_ERROR_FAILED_ PACKET_SENT_TO_DEST(7) :The server failed to send cross channel forwarding media streamCloudHub_RELAY_ERROR_SERVER _CONNECTION_LOST(8) :The SDK disconnects from the server due to poor network quality. You can call the leaveChannel: method to leave the current channel |
Note:
When the status of cross-channel media flow changes, the SDK triggers this callback and reports the current forwarding status and associated error messages
Advanced Signaling Event
rtcChannel:onSetPropertyOfUid:from:properties:
User - defined property change callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onSetPropertyOfUid:(NSString * _Nonnull)uid
from:(NSString * _Nullable)fromuid
properties:(NSString * _Nonnull)prop;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
uid | The user UID of the property change |
fromuid | Uid of the user who initiated the operation |
prop | Changed property, JSON string |
Note:
The local user will receive this callback only if the local user is within the notification range specified when calling setPropertyOfUid:tell:properties: (If not specified, everyone in the channel will be notified)
rtcChannel:onChatMessageArrival:from:withExtraData:
Chat message callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onChatMessageArrival:(NSString * _Nonnull)message
from:(NSString * _Nullable)fromuid
withExtraData:(NSString * _Nullable)extraData;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
message | Message text content |
fromuid | Uid of the user who initiated the operation |
extraData | Additional data, possibly null |
Note:
The local user will receive this callback only if the local user is within the notification range specified when calling [sendChatMsg:to:withExtraData:(If not specified, everyone in the channel will be notified)
rtcChannel:onPubMsg:msgId:from:withData:associatedWithUser:associatedWithMsg:ts:withExtraData:isHistory:
Custom message publishing callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onPubMsg:(NSString * _Nonnull)msgName
msgId:(NSString * _Nonnull)msgId
from:(NSString * _Nullable)fromuid
withData:(NSString * _Nullable)data
associatedWithUser:(NSString * _Nullable)uid
associatedWithMsg:(NSString * _Nullable)assMsgID
ts:(NSUInteger)ts
withExtraData:(NSString * _Nullable)extraData
isHistory:(BOOL)isHistory;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
msgName | The name of the message |
msgId | A message ID is the unique identifier of a message in a channel |
fromuid | Uid of the message sender |
data | Message content: Must be a JSON string, which can be empty |
uid | Uid of associated user: Once a message is associated with a user, the message is automatically deleted when the user exits |
assMsgID | Id of associated message: Once a message is associated with another message, this message is automatically deleted when the associated message is deleted |
ts | The timestamp of the last time the server received the message |
extraData | Keep parameters |
isHistory | Whether the message is sent before the local user enters the channel |
Note:
Local users will receive this callback only if they are within the notification range specified when calling pubMsg:msgId:to:withData:associatedWithUser:associatedWithMsg:save:extraData: (if not specified, everyone in the channel will be notified)
rtcChannel:onPubMsg:msgId:from:withData:associatedWithUser:associatedWithMsg:ts:withExtraData:isHistory:seq:
Custom message publishing callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onPubMsg:(NSString * _Nonnull)msgName
msgId:(NSString * _Nonnull)msgId
from:(NSString * _Nullable)fromuid
withData:(NSString * _Nullable)data
associatedWithUser:(NSString * _Nullable)uid
associatedWithMsg:(NSString * _Nullable)assMsgID
ts:(NSUInteger)ts
withExtraData:(NSString * _Nullable)extraData
isHistory:(BOOL)isHistory
seq:(NSInteger)seq;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
msgName | The name of the message |
msgId | A message ID is the unique identifier of a message in a channel |
fromuid | Uid of the message sender |
data | Message content: Must be a JSON string, which can be empty |
uid | Uid of associated user: Once a message is associated with a user, the message is automatically deleted when the user exits |
assMsgID | Id of associated message: Once a message is associated with another message, this message is automatically deleted when the associated message is deleted |
ts | The timestamp of the last time the server received the message |
extraData | Keep parameters |
isHistory | Whether the message is sent before the local user enters the channel |
seq | Sequence in which the server sends messages |
Note:
The local user will receive this callback only if the local user is within the notification range specified when calling pubMsg:msgId:to:withData:associatedWithUser:associatedWithMsg:save:extraData: (if not specified, everyone in the channel will be notified)
rtcChannel:onDelMsg:msgId:from:withData:
Custom message deletion callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onDelMsg:(NSString * _Nonnull)msgName
msgId:(NSString * _Nonnull)msgId
from:(NSString * _Nullable)fromuid
withData:(NSString * _Nullable)data;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
msgName | The name of the message |
msgId | A message ID is the unique identifier of a message in a channel |
fromuid | Uid of the message sender |
data | Keep parameters |
Note:
Local users will receive this callback only if they are within the notification range specified when calling delMsg:msgId:to: (If not specified, everyone in the channel will be notified)
rtcChannel:onDelMsg:msgId:from:withData:ts:seq:
Custom message deletion callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onDelMsg:(NSString * _Nonnull)msgName
msgId:(NSString * _Nonnull)msgId
from:(NSString * _Nullable)fromuid
withData:(NSString * _Nullable)data
ts:(NSUInteger)ts
seq:(NSInteger)seq;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
msgName | The name of the message |
msgId | A message ID is the unique identifier of a message in a channel |
fromuid | Uid of the message sender |
data | Keep parameters |
ts | Message sending time |
seq | Sequence in which the server sends messages |
Note:
Local users will receive this callback only if they are within the notification range specified when calling delMsg:msgId:to: (If not specified, everyone in the channel will be notified)
rtcChannel:onLocalUserEvicted:
Local user kicked out of channel callback
- (void) rtcChannel:(CloudHubRtcChannelKit * _Nonnull)channel
onLocalUserEvicted:(NSInteger)reason;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
reason | Kicked cause: Filled in by the server, or passed in when calling evictUser:reason: , see details below |
Discussion
When this callback is received, there are two possible reasons:
- When another user calls joinChannelByToken:properties:uid:autosubscribeAudio:autoSubscribeVideo:joinSuccess: and uses the same UID as the local user, the server considers them to be the same and kicks the old user out of the channel. In this case
reason
is 0 - A user calls the evictUser:reason: interface to kick the local user out of the channel. In this case,
reason
is the value ofreason
passed in by the caller
rtcChannelOnHistoryDataReady:
Callback after sending history signaling
- (void) rtcChannelOnHistoryDataReady:(CloudHubRtcChannelKit * _Nonnull)channel;
Parameters | Describe |
---|---|
channel | CloudHubRtcChannelKit Instance pointer |
Discussion
When the historical signaling saved by the server is sent, the SDK triggers the callback