Skip to content

RoomCall

Kenan Genjac edited this page Jun 13, 2024 · 10 revisions



roomCallEventListener

Description

Writable property representing the event handler for room call events.

Example

// 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



networkQualityEventListener

Description

Writable property representing the event listener for local network quality events.

Example

// 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



participantNetworkQualityEventListener

Description

Writable property representing the event listener for other participant's network quality events.

Example

// 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



audioDeviceManager

Description

Read-only property representing the audio device manager which is responsible for handling audio devices during the call.

Example

// Retrieve the active room call and get the audio device manager
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let audioDeviceManager = roomCall?.audioDeviceManager



options

Description

Read-only property representing the call options with which the room is joined.

Example

// Retrieve the active room call and get the call options
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let options = roomCall?.options



status

Description

Read-only property representing the status of the call.

Example

// Retrieve the active room call and get the status
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let status = roomCall?.status



id()

Description

Returns a unique room call identifier.

Returns

  • String - Value of the id field representing a unique room identifier on Infobip RTC platform.

Example

// Retrieve the active room call and get the room ID
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let roomCallId = roomCall?.id()



name()

Description

Returns a room name.

Returns

  • String - Value of the name field representing a room name chosen by a room creator.

Example

// Retrieve the active room call and get the room name
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let name = roomCall?.name()



duration()

Description

Returns call duration in seconds calculated from the time of joining a room. Initially, duration is 0.

Arguments

  • none

Returns

  • Int - Call duration

Example

// 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()
}



joinTime()

Description

Returns time when the user has joined the room. Initially, joinTime is null.

Arguments

  • none

Returns

  • Date? - Time when the user has joined the room.

Example

// 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()
}



leaveTime()

Description

Returns time when the user has left the room. Initially, leaveTime is null.

Arguments

  • none

Returns

  • Date? - Time when the user has left the room.

Example

// 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()
}



participants()

Description

Returns the list of participants currently present in the room.

Arguments

  • none

Returns

Example

// Retrieve the active room call and get the list of participants
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let participants = roomCall?.participants()



remoteVideos()

Description

Returns a map of other participants' videos who currently have their video(s) enabled in the room.

Arguments

  • none

Returns

  • [String:RemoteVideo] - Map that contains remote videos as values and participants' identifiers as keys.

Example

// 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()



mute(shouldMute)

Description

Controls whether the user's audio in the room call should be muted after this action. Disabled by default.

Arguments

  • shouldMute: Bool - true if the audio should be muted, otherwise false.

Returns

  • N/A

Example

// Mute the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.mute(true)



muted()

Description

Returns information whether the user's audio in the room is muted.

Arguments

  • none

Returns

  • Bool - true if the audio is muted, otherwise false.

Example

// Retrieve the active room call and check if it's muted
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let muted = roomCall?.muted()



speakerphone(speakerphone, completionHandler)

Description

Toggles whether sound should be played on the speakerphone or not. When call is started, it is disabled by default.

Arguments

  • speakerphone: Bool - true if the audio should be played on speakerphone, otherwise false.
  • completionHandler: (Error?) -> Void - Completion handler receiving error if setting speakerphone fails

Returns

  • N/A

Example

// 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)")
    }
}



speakerphone()

Description

Returns information whether speakerphone is enabled or not.

Arguments

  • none

Returns

  • Bool - Is speakerphone on

Example

// Retrieve the active room call and check if speakerphone is enabled
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let speakerphoneEnabled = roomCall?.speakerphone()



sendDTMF(dtmf)

Description

Simulates key-press by sending DTMF (Dual-Tone Multi-Frequency) entry.

Arguments

  • dtmf: String - One of the allowed DTMF characters:
    • digits: 0 to 9
    • letters: A to D
    • symbols: * and #

Returns

  • N/A

Throws

  • DTMFError - Error explaining why sending DTMF failed.

Example

// Send DTMF tone "9" through the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.sendDTMF("9")



cameraVideo(cameraVideo)

Description

Controls whether the local camera video should be enabled.

Arguments

  • cameraVideo: Bool - true if local camera video should be enabled, otherwise false.

Returns

  • N/A

Example

// 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.

Example

// 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)
    }
}



hasCameraVideo()

Description

Returns information whether the user has local camera video enabled.

Arguments

  • none

Returns

  • Bool - true if the user has local camera video enabled, otherwisefalse.

Example

// Retrieve the active room call and check if camera video is enabled
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let hasCameraVideo = roomCall?.hasCameraVideo()



screenShare(screenShare)

Description

Controls whether the local screen share video should be enabled.

Arguments

  • screenShare: Bool - true if local screen share video should be enabled, otherwise false.

Returns

  • N/A

Example

// Enable screen sharing for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.screenShare(true)



hasScreenShare()

Description

Returns information whether the user has local screen share video enabled.

Arguments

  • none

Returns

  • Bool - true if the user has local screen share video enabled, otherwisefalse.

Example

// Retrieve the active room call and check if screen sharing is enabled
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let hasScreenShare = roomCall?.hasScreenShare()



localCameraTrack()

Description

Returns local camera track.

Arguments

  • none

Returns

  • VideoTrack? - Video track representing local camera stream. nil if there is no local camera video.

Example

// 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)
    }
}



localScreenShareTrack()

Description

Returns local screen share track.

Arguments

  • none

Returns

  • VideoTrack? - Video track representing local screen share stream. nil if there is no local screen share.

Example

// 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)
    }
}



cameraOrientation(cameraOrientation)

Description

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.

Arguments

Returns

  • N/A

Example

// Set the camera orientation to front for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.cameraOrientation(CameraOrientation.front)



cameraOrientation()

Description

Returns the current camera facing mode.

Arguments

  • none

Returns

Example

// Retrieve the active room call and get the camera orientation
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let cameraOrientation = roomCall?.cameraOrientation()



pauseIncomingVideo()

Description

Pauses incoming video media.

Arguments

  • none

Returns

  • N/A

Example

// Pause the incoming video for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.pauseIncomingVideo()



resumeIncomingVideo()

Description

Resumes incoming video media.

Arguments

  • none

Returns

  • N/A

Example

// Resume the incoming video for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.resumeIncomingVideo()



audioQualityMode(mode)

Description

Sets the audio quality mode to a given enum value.

Arguments

  • mode: AudioQualityMode - Enum value that corresponds to the audio quality mode.

Returns

  • N/A

Example

// Set the audio quality mode to low data for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.audioQualityMode(.lowData)



dataChannel()

Description

Returns an instance of the data channel used to send data.

Arguments

  • none

Returns

  • DataChannel? - Instance of the data channel. nil if the data channel usage is not enabled.

Example

// 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
}



videoFilter(videoFilter?)

Description

This method sets the video filter to be used during the video call. Passing nil will remove and release any already existing video filter.

Arguments

Returns

  • N/A

Example

// Create a video filter
let videoFilter = createVideoFilter()

// Set the video filter for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.videoFilter(videoFilter)



videoFilter()

Description

This method returns the instance of VideoFilter currently in use or nil if no video filter is set.

Arguments

  • none

Returns

Example

// Retrieve the active room call and get the video filter
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
let videoFilter = roomCall?.videoFilter()



clearVideoFilter()

Description

This convenience method removes the video filter if it is present.

Arguments

  • none

Returns

  • N/A

Example

// Clear the video filter for the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.clearVideoFilter()



leave()

Description

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

Arguments

  • none

Returns

  • N/A

Example

// Leave the active room call
let roomCall = getInfobipRTCInstance().getActiveRoomCall()
roomCall?.leave()

Tutorials

Migration guides

Reference documentation

Clone this wiki locally