CloudHubSDK iOS
- Overview
- CloudHubRtcEngineKit
- CloudHubRtcEngineDelegate
- CloudHubRtcChannelKit
- CloudHubRtcChannelDelegate
- CloudHubEnumerates
- CloudHubObjects
API Overview
CloudHub provides a flexible combination of APIs through a globally deployed virtual network, providing reliable real-time audio and video communications for mobile-to-mobile and mobile-to-web
- CloudHubRtcEngineKit Provides the main methods that your app can call.
- CloudHubRtcEngineDelegate Your app can get those notifications through methods that inherit this interface.
Channel management
Method | Description |
---|---|
sharedEngineWithAppId:config: | Creates and initializes CloudHubRtcEngineKit |
sharedEngineWithAppId:config:externalDevices: | Creates and initializes CloudHubRtcEngineKit |
uninitEngine | destroy RTC CloudHubRtcEngineKit |
setChannelProfile: | Set the channel profile. |
setClientRole: | Set the client role. |
joinChannelByToken:channelId:properties:uid: autosubscribeAudio:autoSubscribeVideo:joinSuccess: | Allows a user to join a channel. |
joinChannelByToken:channelId:properties:uid: autosubscribeAudio:autoSubscribeVideo:publishLocalAudio:publishLocalVideo:joinSuccess: | Allows a user to join a channel. |
leaveChannel: | Leaves a channel. |
renewToken: | Gets a new token when the current token expires after a period of time. |
getConnectionState | Gets the current connection state of the SDK. |
Channel events
Event | Description |
---|---|
rtcEngine:didJoinChannelwithUid:elapsed: | Occurs when a user joins a channel. |
rtcEngine:didReJoinChannelwithUid:elapsed: | Occurs when a user rejoins the channel. |
rtcEngine:didLeaveChannel: | Occurs when a user leaves a channel. |
rtcEngine:onClientRoleChangedFrom:to: | Occurs when the user role switches in the interactive live streaming. |
rtcEngine:didJoinedOfUid:properties:isHistory:fromChannel: | Occurs when a remote user (Communication)/ host (LiveBroadcasting) joins the channel. |
rtcEngine:didOfflineOfUid:reason: | Occurs when a remote user (Communication)/ host (LiveBroadcasting) leaves the channel. |
rtcEngine:connectionChangedToState: | Occurs when the network connection state changes. |
rtcEngine:tokenPrivilegeWillExpire: | Occurs when the token expires in 30 seconds. |
rtcEngineRequestToken: | Occurs when the token expires. |
rtcEngine:onLocalUserPermissionChanged:permission: | Occurs When the local users' publish or subscribe permissions change |
Audio management
Method | Description |
---|---|
enableAudio | Enables the audio module. |
disableAudio | Disables the audio module. |
adjustRecordingSignalVolume: | Adjusts the volume of the signal captured by the microphone |
adjustPlaybackSignalVolume: | Adjusts the playback signal volume of all remote users |
adjustUserPlaybackSignalVolume:volume: | Adjust the playback signal volume of a specified remote user |
setPlayoutVolumeRatio: | Output volume gain setting |
enableLocalAudio: | Enables/Disables the local audio capture. |
muteLocalAudioStream: | Stops or resumes publishing the local audio stream. |
muteRemoteAudioStream:mute: | Stops or resumes subscribing to the audio stream of a specified user. |
muteAllRemoteAudioStreams: | Stops or resumes subscribing to the audio streams of all remote users. |
Video management
Method | Description |
---|---|
enableVideo | Enable the video module. |
disableVideo | Disables the video module. |
setVideoEncoderConfiguration: | Sets the video encoder configuration. |
startPlayingLocalVideo:renderMode:mirrorMode: | Play local video |
startPlayingRemoteVideo:streamId:renderMode:mirrorMode: | Start playing remote video |
setLocalRenderMode:mirrorMode: | Updates the display mode of the local video view. |
setRemoteRenderMode:renderMode:mirrorMode: | Updates the display mode of the video view of a remote user. |
enableLocalVideo: | Enables/Disables the local video capture. |
muteLocalVideoStream: | Stops or resumes publishing the local video stream. |
muteRemoteVideoStreamWithUid:mute: | Stops or resumes subscribing to the video stream of a specified user. |
muteRemoteVideoByStreamId:mute: | Stops or resumes subscribing to the video stream of stream id. |
muteAllRemoteVideoStreams: | Stops or resumes subscribing to the video streams of all remote users. |
stopPlayingLocalVideo: | Stop local video |
stopPlayingRemoteVideo: | Stop playing remote video |
setLocalVideoHD | Set local video HD |
setVideoRotation: | Set local video rotation mode |
Local media events
Event | Description |
---|---|
rtcEngine:localAudioStateChange:error: | Occurs when the local audio stream state changes. |
rtcEngine:localVideoStateChangeWithState:error: | Occurs when the local video stream state changes. |
rtcEngineFirstLocalAudioFrame: | Occurs when the first audio frame is published. |
rtcEngine:firstLocalVideoFrameWithSize:elapsed: | Occurs when the first video frame is published. |
rtcEngine:onLocalVideoSizeChanged: | Callback for local video size change |
Remote media events
Event | Description |
---|---|
rtcEngine:remoteAudioStateChangedOfUid:state:reason: | Occurs when the remote audio state changes. |
rtcEngine:remoteVideoStateChangedOfUid:streamId:type:state:reason:streamInfo: | Occurs when the remote video state changes. |
rtcEngine:firstRemoteAudioFrameOfUid: | Occurs when the first audio frame is received. |
rtcEngine:firstRemoteVideoFrameOfUID:streamId:type:Size: | Occurs when the first video frame is received. |
rtcEngine:remoteVideoSizeChangedOfUID:streamId:type:size: | Occurs when the remote video size changes |
Statistics events
After adding a channel, the SDK automatically triggers this group of callbacks every 2 seconds. We provide detailed function description and implementation method documents for these callbacks. Please refer to Quality monitoring during calls.
Event | Description |
---|---|
rtcEngine:remoteAudioStats: | Reports the transport-layer statistics of each remote audio stream. |
rtcEngine:onRtcStats: | Reports the statistics of the current call. |
rtcEngine:onNetworkQuality: | Reports the last mile network quality of each user in the channel. |
rtcEngine:localAudioStats: | Reports the statistics of the local audio stream. |
rtcEngine:localVideoStats: | Reports the statistics of the local video stream. |
rtcEngine:remoteVideoStats: | Reports the transport-layer statistics of each remote video stream. |
Video pre-process and post-process
Method | Description |
---|---|
setBeautyEffectOptions:options: | Set beauty effect |
setVideoEffectEnable:options:device: | Set advanced beauty |
Multi-channel management
Method | Description |
---|---|
createChannel: | Create subchannel |
destroyChannel: | Destroy subchannels |
Media files play(Mobile currently only supports mp4, wav, mp3)
Method | Description |
---|---|
startPlayingMovie:cycle | Start playing media files |
startPlayingMovie:cycle:view:paused: | Start playing media files |
startPlayingMovie:publish:cycle:view:paused | Start playing media files |
stopPlayingMovie: | Stop playing media files |
pausePlayingMovie: | Pause playing media files |
resumePlayingMovie: | Resume playing media files |
getMovieInfo: | Get media playing duration |
getMovieCurrentPosition: | Get media playback progress |
setMoviePosition:withFile: | Set media playback position |
setMovie:volume: | Set the playback volume of music files |
Event | Description |
---|---|
rtcEngine:onLocalMovieStateChanged:state:errorCode: | Local media file playback status changes |
rtcEngine:onLocalMovieProgress:pos:total: | Local media file playback progress |
rtcEngine:firstLocalMovieVideoFrame:size: | Callback of the first frame of media file playback |
Audio effect file playbac(Mobile currently only supports wav, mp3)
Method | Description |
---|---|
getEffectsVolume | Retrieves the volume of the audio effects |
setEffectsVolume: | Sets the volume of the audio effects |
setVolumeOfEffect:volume: | Sets the volume of a specified audio effect |
playEffect:filePath:loopCount:pitch:pan:gain:publish:startTimeMS:endTimeMS: | This method plays the specified local or online audio effect file |
stopEffect: | Stops playing a specified audio effect |
stopAllEffects | Stops playing all audio effects |
preloadEffect:filePath: | Preloads a specified audio effect file into the memory |
unloadEffect: | Releases a specified preloaded audio effect from the memory |
pauseEffect: | Pauses a specified audio effect |
pauseAllEffects | Pauses all audio effects |
resumeEffect: | Resumes playing a specified audio effect |
resumeAllEffects | Resumes playing all audio effects |
translateWavFileToText: | Voice recognition text |
Event | Description |
---|---|
rtcEngine:onAudioEffectFinish: | Occurs when local effect playback has ended |
Voice changer and reverberation
Method | Description |
---|---|
setAudioQuality: | Set local send audio quality. |
setLocalVoicePitch: | Changes the voice pitch of the local speaker |
setLocalVoiceEqualizationOfBandFrequency:withGain: | Sets the local voice equalization effect |
setLocalVoiceReverbOfType:withValue: | Sets the local voice reverberation |
setAudioEffectPreset: | Sets an SDK preset audio effect |
enableDeepLearningDenoise: | Turn on / off AI noise reduction mode |
Sound localization
Method | Description |
---|---|
enableSoundPositionIndication: | Enables/Disables stereo panning for remote users |
setRemoteVoicePosition:pan:gain: | Sets the sound position and gain of a remote user |
Media stream relay across channels
Method | Description |
---|---|
startChannelMediaRelay: | Starts relaying media streams across channels. This method can be used to implement scenarios such as co-host across channels |
updateChannelMediaRelay: | Updates the channels for media stream relay |
stopChannelMediaRelay | Stops the media stream relay. Once the relay stops, the host quits all the destination channels |
Event | Description |
---|---|
rtcEngine:onChannel:MediaRelayStateChanged:error: | Occurs when the state of the media stream relay changes |
Volume indication
Method | Description |
---|---|
enableAudioVolumeIndication:smooth:reportVAD: | Enables the reporting of users' volume indication. |
Event | Description |
---|---|
rtcEngine:reportAudioVolumeIndication:totalVolume: | Reports the volume information of users. |
rtcEngine:onActiveSpeaker: | Active users detected |
Switch speakers or earpieces
Method | Description |
---|---|
setEnableSpeakerphone: | Set current speakers |
isSpeakerphoneEnabled | Gets whether speakers are currently used |
In-ear monitoring
Method | Description |
---|---|
enableInEarMonitoring: | Enables in-ear monitoring |
setInEarMonitoringVolume: | Sets the volume of the in-ear monitor |
Dual Stream
Method | Description |
---|---|
enableDualStreamMode: | Sets the stream mode to single- (default) or dual-stream mode. |
setRemoteVideo:streamType: | Sets the remote user’s video stream type received by the local user when the remote user sends dual streams |
setRemoteDefaultVideoStreamType: | Sets the default video-stream type for the video received by the local user when the remote user sends dual streams |
Stream fallback
Method | Description |
---|---|
setLocalPublishFallbackOption: | Sets the fallback option for the published video stream under unreliable network conditions |
setRemoteSubscribeFallbackOption: | Sets the fallback option for the remote stream under unreliable network conditions |
Event | Description |
---|---|
rtcEngine:didLocalPublishFallbackToAudioOnly:deviceId: | The local publishing stream has fallen back to audio stream or reverted to audio and video stream callback |
rtcEngine:didRemoteSubscribeFallbackToAudioOnly:byUid:type:streamId: | The remote subscription stream has fallen back to an audio stream or reverted to an audio and video stream callback |
Pre-call network test
Method | Description |
---|---|
startEchoTest: | Starts an audio call test |
stopEchoTest | Stops the audio call test |
startLastmileProbeTest: | Starts the last mile network probe test |
stopLastmileProbeTest | Stops the last mile network probe test |
Event | Description |
---|---|
rtcEngine:onLastmileQuality: | Reports the last-mile network quality of the local user once every two seconds |
rtcEngine:onLastmileProbeResult: | Reports the last mile network probe result |
Audio self-capture(only push)
Method | Description |
---|---|
setExternalAudioSourceSampleRate:channels: | Sets the external audio source |
pushAudioFrame: | Pushes the external audio frame |
Audio self-rendering(only pull)
Method | Description |
---|---|
setExternalAudioSinkSampleRate:channels: | Format rendered data |
pullAudioFrame: | Pulls the external audio frame |
Raw audio data
Method | Description |
---|---|
setRecordingAudioFrameSampleRate:channels:samples: | Set the format of the captured raw audio data |
setPlaybackAudioFrameSampleRate:channels:samples: | Sets the audio data format for playback |
Event | Description |
---|---|
rtcEngine:onRecordAudioFrame:sampleRate:channels: | Gets the captured audio frame |
rtcEngine:onPlaybackAudioFrame:sampleRate:channels: | Gtes the audio frame for playback |
Audio recorder
Method | Description |
---|---|
startRecordingVoiceClip:duration:fileType: | Start recording sound clip |
stopRecordingVoiceClip: | Stop recording sound clip |
Event | Description |
---|---|
rtcEngine:voiceClipFileReady:clip:ts: | Record sound clip callback |
rtcEngine:onVoiceTranslateTextReady:text: | Sound file recognition callback |
Switch cameras
Method | Description |
---|---|
switchCamera: | Switch cameras |
setCameraFlipMode:Vertivcal: | Set the flip mode of the camera. |
correctCameraKeystoning: | Calibration camera |
resetCameraKeystoning | Cancel camera calibration |
Device manager
Event | Description |
---|---|
rtcEngine:didAudioRouteChanged: | Audio output device change notification |
Data stream
Method | Description |
---|---|
sendStreamMessage: | Sends data stream messages |
Event | Description |
---|---|
rtcEngine:onStreamMessagWithUid:data: | Occurs when the local user receives the data stream from the remote user |
Publish management
Method | Description |
---|---|
setPublishStreamInfo: | Set user data when publishing local audio and video(Json) |
publishStream | Start publishing local audio and video |
unPublishStream | Stop publishing local audio and video |
Manual subscription management
Method | Description |
---|---|
subscribe: | Start subscribing to audio and video |
unSubscribe: | Stop subscribing to audio and video |
Remote publish event(only when auto subscription mode is turned off)
Method | Description |
---|---|
rtcEngine:onUserPublished:type:stream: | Occurs when remote user starts publishing video |
rtcEngine:onUserUnPublished:type:stream: | Occurs when remote user stops publishing video |
Server recording
Method | Description |
---|---|
startServerRecord | Start server recording |
stopServerRecord | Stop server recording |
pauseServerRecord | Pause server recording |
resumeServerRecord | Resume server recording |
Event | Description |
---|---|
rtcEngine:onServerRecordStateChange: startTS:currTS:pauseDuration:recordDuration: | Occurs when server recording status change |
Advanced signaling method
Method | Description |
---|---|
setPropertyOfUid:tell:properties: | Set custom attributes for a user in the channel |
sendChatMsg:to:withExtraData: | Send chat message |
pubMsg:msgId:to:withData: associatedWithUser:associatedWithMsg:save:extraData: | Publish a custom message |
delMsg:msgId:to: | Delete a custom message |
evictUser:reason: | Evict user |
Advanced signaling event
Event | Description |
---|---|
rtcEngine:onSetPropertyOfUid:from:properties: | Occurs when the user property changes |
rtcEngine:onChatMessageArrival:from:withExtraData: | Occurs when received chat message |
rtcEngine:onPubMsg:msgId:from:withData: associatedWithUser:associatedWithMsg:ts:withExtraData:isHistory: | Occurs when receiving signaling |
rtcEngine:onDelMsg:msgId:from:withData: | Occurs when deleteing signaling |
rtcEngine:onLocalUserEvicted: | Occurs when local users are evicted |
rtcEngine:onChannelForceClosed:reason: | Occurs when the channel was closed by the server |
rtcEngineOnHistoryDataReady: | Callback after sending historical signaling |
CDN publisher
Method | Description |
---|---|
addPublishStreamUrl: | Publishes the local stream to a specified CDN live streaming URL |
removePublishStreamUrl: | Removes an RTMP or RTMPS stream from the CDN |
setLiveTranscoding: | Sets the transcoding configurations for CDN live streaming |
Other method
Method | Description |
---|---|
getCallId | Retrieves the call ID |
getSdkVersion | Gets the SDK version |
setLogFilter: | Sets the log output level of the SDK. |
getNativeHandle | Gets the Native SDK Engine Handle |
Other event
Event | Description |
---|---|
rtcEngine:didOccurError:withMessage: | Occur error |
rtcEngine:onServerTime: | Callback to return server time |
rtcEngine:onDocAddr:serial: | Return the address of the courseware server |