ANONYMOUS VIDEO Call
RTC 555 iOS SDK supports ANONYMOUS VIDEO call. It supports Multi-party video conference feature, where multiple participants can join the same call. Also supports on-call features such as mute/unmute audio/video, and flip camera.
Before initiating or joining an Anonymous VIDEO call, you need to login anonymously.
SDK initialization
Below API initializes and sets the context for the SDK. It is advisable to call this API at the launch of the application.
Rtc555Sdk.initializeLibrary()
Adding SDK configuration.
To make anonymous video related API call, SDK should have below mentioned mandatory configuration data to establish a connection with the 555 platform backend.
let config:Rtc555Config = Rtc555Sdk.sharedInstance.getConfig()
config.routingId = "<random uuid used for anonymous login>@<appdomain>"
config.url = "https://evm.iris.comcast.net" // Event manager URL
config.token = "<555 JWT token>" // JWT token for accessing the 555 SDK/backend APIs. Token can be accessed from the 555 anonymous login response.
config.domain = "uciris12.comcast.net" // *Optional
config.isAnonymous = true // Set it to true for anonymous video call.
Rtc555Sdk.setConfig(config: config)
Create Stream
To make a anonymous video related API call, you need to create a stream that will provide you with the local stream id required for anonymous video call APIs. To create stream, pass callType & Rtc555VideoDelegate to createStream API.
Rtc555Video.createStream(callType: callType, rtcVideoDelegate: self)
Parameters | Type | Description |
---|---|---|
callType | string | Pass any non-empty string for anonymous video call |
rtcVideoDelegate | Rtc555VideoDelegate | Delegate object for getting local stream Id |
Initiate or Join Anonymous Video Call
To initiate or join an anonymous video call, pass a target room name which can be any name provided by the user, local stream id & Rtc555VideoDelegate to anonymousCall API.
NOTE: For multiple users to join the same call, the target room name has to be the same.
anonymousCall API returns enum Result. Success case of result will return call id and failure case return error code and reason for the error.
Rtc555Video.anonymousCall(targetRoomName: roomName, streamId: localStreamId, rtcVideoDelegate: self) { result in
switch(result){
case .success(let callId):
print("Anonymous call Success. \(callId)")
case .failure(let error):
print("Anonymous call Failed with error \(error)")
}
}
Parameters | Type | Description |
---|---|---|
targetRoomName | string | Room name provided by the user |
streamId | string | local stream ID received from onLocalStream delegate |
rtcVideoDelegate | Rtc555VideoDelegate | Delegate object for getting remote stream Id, call status and error callback |
Leave an Active Anonymous Video Call
Users need to call hangup API to leave the anonymous call.
Rtc555Video.hangup(callId: callId)
Parameters | Description |
---|---|
callId | callId is a unique id for the call which was returned from anonymousCall API |
Clean up the session.
Call the below API in Rtc555Sdk to release all the resources used by SDK. This call also allows the client to disconnect from the 555 platform backend. The app developer should call this API if the app goes to the background or kill state to release the SDK resource. Client need to call setConfig API again before attempting to initiate/accept the call.
Rtc555Sdk.cleanup()
Callkit Support
Callkit in client requires below API calls from SDK
Initialize Audio Unit
This API call allows users to manually initialize Audio Unit while using CallKit. The user needs to call this before starting/joining the call.
Rtc555Voice.initilizeManualAudio(audioManual: Bool)
Parameters | Type | Description |
---|---|---|
audioManual | Bool | Pass Yes to initilize Audio unit Manually |
Activate/Deactive Audio Unit
This API is only effective if initilizeManualAudio is YES. This API call allows users to activate/deactivate audio while using callkit. Need to call this API in provider(:didActivate:) delegate and provider(:didDeactivate:) delegate.
Rtc555Voice.enableAudio(enableAudio: Bool)
//Usage :: Callkit delegates
func provider(_ provider: CXProvider, didDeactivate audioSession: AVAudioSession) {
Rtc555Voice.enableAudio(enableAudio: false)
}
func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) {
Rtc555Voice.enableAudio(enableAudio: true)
}
Parameters | Type | Description |
---|---|---|
enableAudio | Bool | Pass Yes or No to start /stop the Audio unit |
Video On-call Features
Features offered by iOS SDK for Video call are:
Toggle Audio Mute
This API call allows the users to mute and unmute its audio in the call.
Rtc555Video.audioMuteToggle(callId: callId)
Parameters | Description |
---|---|
callId | callId is a unique id for this call which was returned from call/accept API |
Toggle Video Mute
This API call allows the user to mute and unmute its video in the call.
Rtc555Video.videoMuteToggle(callId: callId)
Parameters | Description |
---|---|
callId | callId is a unique id for this call which was returned from call/accept API |
Flip Camera
This API call allows users to flip between the front and rear camera of the device.
Rtc555Video.flipCamera()
Video Call Delegates
To get local stream Id, remote stream Id, and call status or error report during the call, Rtc555VideoDelegate is passed to the call/accept API call. This delegate provides the below callbacks.
onLocalStream
This callback gets invoked when we receive the local stream id which is required to make/accept the call. This local stream can be used to render local video on the device screen using RtcRenderer.
func onLocalStream(streamId mediastreamId: String) {
}
Parameters | Description |
---|---|
streamId | Local Stream Id |
onParticipantJoined
This callback gets invoked when the participant joins the call. Stream ID can be used to render the remote video on the device screen using RtcRenderer.
func onParticipantJoined(streamId:streamId, participantId: participantId) {
}
Parameters | Description |
---|---|
streamId | Remote Stream Id |
participantId | Id of participant who joined the call |
onParticipantLeft
This callback gets invoked when the participant leaves the call.
func onParticipantLeft(participantId: participantId) {
}
Parameters | Description |
---|---|
participantId | Id of participant who left the call |
onDominantSpeakerChanged
This callback gets invoked when the participant is actively speaking.
func onDominantSpeakerChanged(participantId: participantId) {
}
Parameters | Description |
---|---|
participantId | Id of actively speaking particiapnt in the call |
onStatus
This callback gets invoked when we receive the status of the ongoing call.
func onStatus(status callStatus: CallStatus,id callId:String) {
}
Parameters | Description |
---|---|
callStatus | status of ongoing call |
callId | Call id for the ongoing call |
Call Status:
- initializing - When the call is initializing
- connecting - When the call is connecting i.e. when remote party is ringing.
- connected - When the call is connected and media(video) started transferring.
- disconnected - When the call is disconnected i.e. when remote side hang up the call.
onError
This callback gets invoked when we receive an error from an ongoing video call.
func onError(error errorInfo: Error,id callId:String) {
}
Parameters | Description |
---|---|
errorInfo | error object consists of error code and error message |
callId | callId received from backend |
Video Call Renderer
The video call renderer referred to as RtcRenderer provided by the Rtc555Sdk is used to render the video on the UI using stream id from Local Stream and Remote Stream.
Initilize RtcRenderer
To initialize, you need to pass the size of the View which needs to render the video stream. After that, you need to add the videoView variable of RtcRenderer to the UIView.
//Local
var localRenderer = RtcRenderer(frameSize: self.localView.bounds)
self.localView.insertSubview(localRenderer.videoView)
//Remote
var remoteRenderer = RtcRenderer(frameSize: self.remoteView.bounds)
self.remoteView.insertSubview(remoteRenderer.videoView)
Parameters | Description |
---|---|
frameSize | size of the rendering UIView |
Add Stream
This API adds the Stream id received from Local Stream and Remote Stream to local/remote RtcRenderer.
self.localRenderer.addStream(streamId: localStreamId)
self.remoteRenderer.addStream(streamId: remoteStreamId)
Parameters | Description |
---|---|
streamId | Stream Id received from onLocalStream/onRemoteStream |