Two-Way Calling
Pre-requisite
- The camera should have already started streaming LiveView before making any interactions.
- The camera should support the two way calling feature, and the
liveViewObjectshould have been created withsupportsCallingset to true.
Create a Call Event
To register the start of a call with the backend, The following method can be used:
spaceId(required): The space ID of the device.deviceId(required): The device ID.request(required): The request object containing the device id and the call start time.
Factory.deviceService.createTwoWayCallEvent(spaceId: String, deviceId: String, request: TwoWayCallEventRequest?) -> IVPublisher<TwoWayCallEventModel>
Send the Call Event Id to the Camera
To pass the created call event id to the camera, The following can be used:
callEventId(required): The id returned bycreateTwoWayCallEvent.
liveViewObject.sendTwoWayCallEventId(callEventId: String)
Accept a Call
To inform the camera that the user has accepted the call, The following can be used:
liveViewObject.sendAcceptedTwoWayCall()
Disconnect a Call
To inform the camera that the call has ended, The following can be used:
liveViewObject.sendDisconnectTwoWayCall()
Update the Call Status
To report the outcome of the call to the backend, The following method can be used:
spaceId(required): The space ID of the device.deviceId(required): The device ID.callId(required): The id of the call event.request(required): The request object containing the call status and the end time.
Factory.deviceService.updateTwoWayCallStatus(spaceId: String, deviceId: String, callId: String, request: TwoWayCallStatusRequest?) -> IVPublisher<Void>
Send the User’s Video
To toggle the video captured from the phone and sent to the camera, The following can be used:
enable(required): Whether the local video should be sent.localView(required): The view rendering the phone’s own camera.
liveViewObject.enableLocalVideo(enable: Bool, localView: IVVideoView)
Switch the Phone Camera
To switch between the front and back camera of the phone, The following can be used:
liveViewObject.switchCamera()