-
Notifications
You must be signed in to change notification settings - Fork 3
RoomCall
roomCallEventListener: RoomCallEventListener?
networkQualityEventListener: NetworkQualityEventListener?
participantNetworkQualityEventListener: ParticipantNetworkQualityEventListener?
audioDeviceManager: AudioDeviceManager
options: RoomCallOptions
status: CallStatus
id() -> String
name() -> String
duration() -> Int
joinTime() -> Date?
leaveTime() -> Date?
participants() -> [Participant]
remoteVideos() -> [String:RemoteVideo]
mute(_ shouldMute: Bool)
muted() -> Bool
speakerphone(_ speakerphone: Bool, _ completionHandler: @escaping (Error?) -> Void)
speakerphone() -> Bool
sendDTMF(_ dtmf: String) throws -> Void
cameraVideo(cameraVideo: Bool) -> Void
hasCameraVideo() -> Bool
screenShare(screenShare: Bool) -> Void
hasScreenShare() -> Bool
localCameraTrack() -> VideoTrack?
localScreenShareTrack() -> VideoTrack?
cameraOrientation() -> CameraOrientation
cameraOrientation(_ cameraOrientation: CameraOrientation)
pauseIncomingVideo() throws -> Void
resumeIncomingVideo() throws -> Void
audioQualityMode(_ mode: AudioQualityMOde) -> Void
dataChannel() -> DataChannel?
videoFilter(_ videoFilter: VideoFilter?) -> Void
videoFilter() -> VideoFilter?
clearVideoFilter() -> Void
leave()
Writable property representing the event handler for room call events.
// Retrieve the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
// Set the room call event listener to be handled by 'self'
roomCall?.roomCallEventListener = self
// Get the room call event listener
let roomCallEventListener = roomCall?.roomCallEventListener
Writable property representing the event listener for local network quality events.
// Retrieve the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
// Set the network quality event listener to be handled by 'self'
roomCall?.networkQualityEventListener = self
// Get the network quality event listener
let networkQualityEventListener = roomCall?.networkQualityEventListener
Writable property representing the event listener for other participant's network quality events.
// Retrieve the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
// Set the participant network quality event listener to be handled by 'self'
roomCall?.participantNetworkQualityEventListener = self
// Get the participant network quality event listener
let participantNetworkQualityEventListener = roomCall?.participantNetworkQualityEventListener
Read-only property representing the audio device manager which is responsible for handling audio devices during the call.
// Retrieve the active room call and get the audio device manager
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let audioDeviceManager = roomCall?.audioDeviceManager
Read-only property representing the call options with which the room is joined.
// Retrieve the active room call and get the call options
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let options = roomCall?.options
Read-only property representing the status of the call.
// Retrieve the active room call and get the status
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let status = roomCall?.status
Returns a unique room call identifier.
-
String
- Value of theid
field representing a unique room identifier on Infobip RTC platform.
// Retrieve the active room call and get the room ID
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let roomCallId = roomCall?.id()
Returns a room name.
-
String
- Value of thename
field representing a room name chosen by a room creator.
// Retrieve the active room call and get the room name
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let name = roomCall?.name()
Returns call duration in seconds calculated from the time of joining a room. Initially, duration is 0
.
none
-
Int
- Call duration
// Retrieve the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
// Define a function to handle the room left event
func onRoomLeft(_ roomLeftEvent: RoomLeftEvent) {
// Get the duration of the active room call
let duration = roomCall?.duration()
}
Returns time when the user has joined the room. Initially, joinTime is null
.
none
-
Date?
- Time when the user has joined the room.
// Retrieve the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
// Define a function to handle the room joined event
func onRoomJoined(_ roomJoinedEvent: RoomJoinedEvent) {
// Get the join time of the active room call
let joinTime = roomCall?.joinTime()
}
Returns time when the user has left the room. Initially, leaveTime is null
.
none
-
Date?
- Time when the user has left the room.
// Retrieve the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
// Define a function to handle the room left event
func onRoomLeft(_ roomLeftEvent: RoomLeftEvent) {
// Get the leave time of the active room call
let leaveTime = roomCall?.leaveTime()
}
Returns the list of participants currently present in the room.
none
-
[Participant]
- List of participants.
// Retrieve the active room call and get the list of participants
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let participants = roomCall?.participants()
Returns a map of other participants' videos who currently have their video(s) enabled in the room.
none
-
[String:RemoteVideo]
- Map that contains remote videos as values and participants' identifiers as keys.
// Retrieve the active room call and get the map of remote videos for every participant that has video(s) enabled
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let remoteVideos = roomCall?.remoteVideos()
Controls whether the user's audio in the room call should be muted after this action. Disabled by default.
-
shouldMute
:Bool
-true
if the audio should be muted, otherwisefalse
.
N/A
// Mute the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.mute(true)
Returns information whether the user's audio in the room is muted.
none
-
Bool
-true
if the audio is muted, otherwisefalse
.
// Retrieve the active room call and check if it's muted
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let muted = roomCall?.muted()
Toggles whether sound should be played on the speakerphone or not. When call is started, it is disabled by default.
-
speakerphone
:Bool
-true
if the audio should be played on speakerphone, otherwisefalse
. -
completionHandler
:(Error?) -> Void
- Completion handler receiving error if setting speakerphone fails
N/A
// Enable speakerphone for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.speakerphone(true) { error in
// Handle any errors that may occur
if let error = error {
print("An error has occurred: \(e.description)")
}
}
Returns information whether speakerphone is enabled or not.
none
-
Bool
- Is speakerphone on
// Retrieve the active room call and check if speakerphone is enabled
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let speakerphoneEnabled = roomCall?.speakerphone()
Simulates key-press by sending DTMF (Dual-Tone Multi-Frequency) entry.
-
dtmf
:String
- One of the allowed DTMF characters:- digits:
0
to9
- letters:
A
toD
- symbols:
*
and#
- digits:
N/A
-
DTMFError
- Error explaining why sending DTMF failed.
// Send DTMF tone "9" through the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.sendDTMF("9")
Controls whether the local camera video should be enabled.
-
cameraVideo
:Bool
-true
if local camera video should be enabled, otherwisefalse
.
N/A
// Enable camera video for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.cameraVideo(true)
Note
When your application goes into background, due to iOS limitations of needing a UI to continue capturing video frames, the video capture will stop until the application is back in foreground. To mitigate this, when your application is in background, you should either have a floating video component in order to continue capturing the video or stop the video completely. Below is an example of detecting when your application is in background and turning off the video.
// Observe application background notifications
NotificationCenter.default.addObserver(self, selector:#selector(appMovedToBackground), name: UIApplication.didEnterBackgroundNotification, object: nil)
@objc func appMovedToBackground() throws {
if let activeRoomCall = self.getActiveRoomCall(), activeRoomCall.hasCameraVideo() == true {
try activeRoomCall.cameraVideo(cameraVideo: false)
}
}
Returns information whether the user has local camera video enabled.
none
-
Bool
-true
if the user has local camera video enabled, otherwisefalse
.
// Retrieve the active room call and check if camera video is enabled
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let hasCameraVideo = roomCall?.hasCameraVideo()
Controls whether the local screen share video should be enabled.
-
screenShare
:Bool
-true
if local screen share video should be enabled, otherwisefalse
.
N/A
// Enable screen sharing for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.screenShare(true)
Returns information whether the user has local screen share video enabled.
none
-
Bool
-true
if the user has local screen share video enabled, otherwisefalse
.
// Retrieve the active room call and check if screen sharing is enabled
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let hasScreenShare = roomCall?.hasScreenShare()
Returns local camera track.
none
-
VideoTrack?
- Video track representing local camera stream.nil
if there is no local camera video.
// Retrieve the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
// Check if there is a local camera track
if let localCameraTrack = roomCall?.localCameraTrack() {
// If there is a local view available, add the camera track renderer to it
if let localView = self.localView {
localCameraTrack.addRenderer(localView)
}
}
Returns local screen share track.
none
-
VideoTrack?
- Video track representing local screen share stream.nil
if there is no local screen share.
// Retrieve the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
// Check if there is a local screen share track
if let localScreenShareTrack = roomCall?.localScreenShareTrack() {
// If there is a local view available, add the screen share track renderer to it
if let localView = self.localView {
localScreenShareTrack.addRenderer(localView)
}
}
Change the local camera facing mode. No action will be performed if the current camera facing mode is the same as the
requested one. Default is front
.
-
cameraOrientation
:CameraOrientation
- Camera facing mode.
N/A
// Set the camera orientation to front for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.cameraOrientation(CameraOrientation.front)
Returns the current camera facing mode.
none
-
CameraOrientation
- Camera facing mode.
// Retrieve the active room call and get the camera orientation
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let cameraOrientation = roomCall?.cameraOrientation()
Pauses incoming video media.
none
N/A
// Pause the incoming video for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.pauseIncomingVideo()
Resumes incoming video media.
none
N/A
// Resume the incoming video for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.resumeIncomingVideo()
Sets the audio quality mode to a given enum value.
-
mode
:AudioQualityMode
- Enum value that corresponds to the audio quality mode.
N/A
// Set the audio quality mode to low data for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.audioQualityMode(.lowData)
Returns an instance of the data channel used to send data.
none
-
DataChannel?
- Instance of the data channel.nil
if the data channel usage is not enabled.
// Retrieve the active room call and get the data channel
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
if let dataChannel = roomCall?.dataChannel() {
// Send text using the data channel
}
This method sets the video filter to be used during the video call. Passing nil
will remove and release any already
existing video filter.
-
videoFilter
:VideoFilter?
- An instance ofVideoFilter
.
N/A
// Create a video filter
let videoFilter = createVideoFilter()
// Set the video filter for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.videoFilter(videoFilter)
This method returns the instance of VideoFilter
currently in use or nil
if no video filter is set.
none
-
VideoFilter?
- An instance ofVideoFilter
.
// Retrieve the active room call and get the video filter
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let videoFilter = roomCall?.videoFilter()
This convenience method removes the video filter if it is present.
none
N/A
// Clear the video filter for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.clearVideoFilter()
Leaves the room, which results in the following events:
- user who left the room receives the
RoomLeftEvent
- all the other participants who remained in the room receive the
ParticipantLeftEvent
referencing the participant who left the room
none
N/A
// Leave the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.leave()