Skip to content

RoomCall

Lejla Solak edited this page Mar 31, 2025 · 15 revisions



id()

Description

Returns a unique call identifier.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
String id = roomCall.id();



options()

Description

Getter for the options field.

Arguments

  • none

Returns

  • RoomCallOptions - The value of the options field representing the call options which the room is joined with.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
RoomCallOptions roomCallOptions = roomCall.options();



status()

Description

Returns current call status.

Arguments

  • none

Returns

  • CallStatus - The value of the status field representing the status of the call.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
CallStatus status = roomCall.status();



name()

Description

Returns a room name.

Arguments

  • none

Returns

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

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
String 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

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
int callDuration = roomCall.duration();



joinTime()

Description

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

Arguments

  • none

Returns

  • Date - Time when user joined the room

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
Date joinTime = roomCall.joinTime();



leaveTime()

Description

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

Arguments

  • none

Returns

  • Date - Time when user left the room

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
Date leaveTime = roomCall.leaveTime();



participants()

Description

Returns the list of participants currently present in the room.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
List<Participant> 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

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
Map<String, RemoteVideo> 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: boolean - true if the audio should be muted, otherwise false.

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    try {
        roomCall.mute(true);
    } catch (ActionFailedException e) {
        Log.w("Room", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



muted()

Description

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

Arguments

  • none

Returns

  • boolean - trueif the audio is muted, otherwise false`.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
boolean muted = roomCall.muted();



speakerphone(enabled)

Description

Controls whether the audio should be played on the speakerphone. Disabled by default. If disabled, the audio will be played through the next available audio device based on the priority order.

Arguments

  • enabled: boolean - true if the audio should be played on speakerphone, otherwise false.

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    roomCall.speakerphone(true);
}



speakerphone()

Description

Returns information whether speakerphone is enabled or not.

Arguments

  • none

Returns

  • boolean - true if the speakerphone is enabled, otherwise false.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
boolean speakerphone = 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

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    try {
        roomCall.sendDTMF("7");
    } catch (ActionFailedException e) {
        Log.w("Room", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



cameraVideo(cameraVideo)

Description

Controls whether the local camera video should be enabled.

Arguments

  • cameraVideo: boolean - Whether camera video should be enabled or not.

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    try {
        roomCall.cameraVideo(true);
    } catch (ActionFailedException e) {
        Log.w("Room", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



hasCameraVideo()

Description

Returns information whether the user has local camera video enabled.

Arguments

  • none

Returns

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

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
boolean hasCameraVideo = roomCall.hasCameraVideo();



startScreenShare(screenCapturer)

Description

Starts sharing screen with the active room call. Needs to be called after RoomJoinedEvent is received.

Note: Starting from Android 14, screen share must be started from a foreground service. For more information, please refer to the Screen Share tutorial.

Arguments

Returns

  • N/A

Throws

Example

private void startScreenShare(int resultCode, Intent data) {
    try {
        ScreenCapturer screenCapturer = new ScreenCapturer(resultCode, data);
        RoomCall roomCall = InfobipRTC.getInstance().getActiveRoomCall();
        if (roomCall != null) {
            roomCall.startScreenShare(screenCapturer);
        }
    } catch (ActionFailedException e) {
        Log.e("ScreenShareService", "Failed to start screen share", e);
    }
}



resetScreenShare()

Description

The size of the media projection can change when the device is rotated or the user selects an app window as the capture region in app screen sharing. The media projection might be letterboxed if the captured content differs from the window size obtained when screen sharing started.

To prevent this and ensure the projection matches the captured content’s size and aspect ratio, use this method to resize the capture whenever the content changes - whether due to rotation or a different windowing mode.

Note: On Android 14 and later, the system automatically handles resizing, so you only need to call this method on earlier versions. If called on Android 14 or later, it has no effect as it is ignored.

Arguments

  • none

Returns

  • N/A

Example

Specify the configuration changes your app handles by setting the android:configChanges attribute of the <activity> element in your AndroidManifest.xml file.

Note: Android handles any configuration changes you don't specify in configChanges; that is, the system destroys and recreates your app's activities.

For example, enable your app to handle screen size and orientation changes:

<activity
        android:name=".MainActivity"
        android:configChanges="orientation|screenSize"/>
public class MainActivity extends AppCompatActivity {
    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);

        // Check for screen size or orientation changes
        if ((newConfig.configChanges & (Configuration.CONFIG_SCREEN_SIZE | Configuration.CONFIG_ORIENTATION)) != 0) {
            InfobipRTC infobipRTC = InfobipRTC.getInstance();
            RoomCall roomCall = infobipRTC.getActiveRoomCall();
            roomCall.resetScreenShare();
        }
    }
}



stopScreenShare()

Description

Stops sharing screen with the room.

Arguments

  • none

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    try {
        roomCall.stopScreenShare();
    } catch (ActionFailedException e) {
        Log.w("Room", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



hasScreenShare()

Description

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

Arguments

  • none

Returns

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

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
boolean hasScreenShare = roomCall.hasScreenShare();



localCameraTrack()

Description

Returns video track for local camera video.

Arguments

  • none

Returns

  • RTCVideoTrack - Video track representing local camera stream. null if there is no local camera video.

Example

private void example() {
    VideoRenderer localCameraVideoRenderer = findViewById(R.id.local_camera_video);
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    RTCVideoTrack localCamera = roomCall.localCameraTrack();
    if (localCamera != null) {
        localCamera.addSink(localCameraVideoRenderer);
    }
}



localScreenShareTrack()

Description

Returns video track for local screen share.

Arguments

  • none

Returns

  • RTCVideoTrack - Video track representing local screen share stream. null if there is no local screen share.

Example

private void example() {
    VideoRenderer localScreenShareVideoRenderer = findViewById(R.id.local_screen_share_video);
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    RTCVideoTrack localScreenShare = roomCall.localScreenShareTrack();
    if (localScreenShare != null) {
        localScreenShare.addSink(localScreenShareVideoRenderer);
    }
}



setEventListener(roomCallEventListener)

Description

Configures event handler for room call events.

Arguments

  • roomCallEventListener: RoomCallEventListener - Interface with event methods that should be implemented, method per room call event to be handled.

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    roomCall.setEventListener(new DefaultRoomCallEventListener() {
        @Override
        public void onRoomJoined(RoomJoinedEvent roomJoinedEvent) {
            Toast.makeText(getApplicationContext(), "Room joined!", Toast.LENGTH_LONG);
        }

        @Override
        public void onParticipantJoined(ParticipantJoinedEvent participantJoinedEvent) {
            Toast.makeText(getApplicationContext(), "Participant joined!", Toast.LENGTH_LONG);
        }

        @Override
        public void onParticipantLeft(ParticipantLeftEvent participantLeftEvent) {
            Toast.makeText(getApplicationContext(), "Participant left!", Toast.LENGTH_LONG);
        }

        @Override
        public void onRoomLeft(RoomLeftEvent roomLeftEvent) {
            Toast.makeText(getApplicationContext(), "Room left!", Toast.LENGTH_LONG);
        }
    });
}



getEventListener()

Description

Returns event handler for room call events.

Arguments

  • none

Returns

  • RoomCallEventListener - Interface that should be implemented in order to handle room call events properly.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
RoomCallEventListener roomCallEventListener = roomCall.getEventListener();



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 value is FRONT.

Arguments

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    roomCall.cameraOrientation(VideoOptions.CameraOrientation.BACK);
}



cameraOrientation()

Description

Returns the current camera facing mode.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
VideoOptions.CameraOrientation cameraOrientation = roomCall.cameraOrientation();



pauseIncomingVideo()

Description

Pauses incoming video media.

Arguments

  • none

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    try {
        roomCall.pauseIncomingVideo();
    } catch (ActionFailedException e) {
        Log.w("Room", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



resumeIncomingVideo()

Description

Resumes incoming video media.

Arguments

  • none

Returns

  • N/A

Throws

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    try {
        roomCall.resumeIncomingVideo();
    } catch (ActionFailedException e) {
        Log.w("Room", String.format("Failed to execute action. Error: %s", e.getErrorCode().getDescription()));
    }
}



setNetworkQualityEventListener(networkQualityEventListener)

Description

Configures event handler for local network quality events.

Arguments

  • networkQualityEventListener: networkQualityEventListener - Interface that should be implemented in order to handle local network quality events properly.

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    roomCall.setNetworkQualityEventListener(networkQualityChangedEvent -> {
        NetworkQuality networkQuality = networkQualityChangedEvent.getNetworkQuality();
        Log.i("Room", String.format("Local network quality is: %s (score: %s)", networkQuality, networkQuality.getScore()));
    });
}



getNetworkQualityEventListener()

Description

Returns event handler for local network quality events.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
NetworkQualityEventListner networkQualityEventListner = roomCall.getNetworkQualityEventListener();



setParticipantNetworkQualityEventListener(participantNetworkQualityEventListener)

Description

Configures event handler for other participant's network quality events.

Arguments

  • participantNetworkQualityEventListener: ParticipantNetworkQualityEventListener - Interface that should be implemented in order to handle other participant's network quality events properly.

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    roomCall.setParticipantNetworkQualityEventListener(participantNetworkQualityChangedEvent -> {
        Participant participant = participantNetworkQualityChangedEvent.getParticipant();
        NetworkQuality networkQuality = participantNetworkQualityChangedEvent.getNetworkQuality();
        Log.i("Room", String.format("%s's network quality changed to %s (value %s)", participant.getEndpoint().identifier(), networkQuality, networkQuality.getScore()));
    });
}



getParticipantNetworkQualityEventListener()

Description

Returns event handler for other participant's network quality events.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
ParticipantNetworkQualityEventListener participantNetworkQualityEventListener = roomCall.getParticipantNetworkQualityEventListener();



audioDeviceManager()

Description

Returns the instance of AudioDeviceManager that should be used to manage the audio devices in the current call.

Arguments

  • none

Returns

  • AudioDeviceManager - An instance of AudioDeviceManager specifically designed for handling audio devices.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
AudioDeviceManager audioDeviceManager = roomCall.audioDeviceManager();



audioQualityMode(audioQualityMode)

Description

Sets the audio quality mode to a given enum value.

Arguments

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    roomCall.audioQualityMode(AudioOptions.AudioQualityMode.LOW_DATA);
}



audioQualityMode()

Description

Returns the audio quality mode that is used during the call.

Arguments

  • none

Returns

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    AudioOptions.AudioQualityMode audioQualityMode = roomCall.audioQualityMode();
}



dataChannel()

Description

Returns the instance of DataChannel that should be used to send and receive data during the current call.

Arguments

  • none

Returns

  • DataChannel - An instance of DataChannel specifically designed for handling actions on data channel. null if data channel is not enabled in call options.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
DataChannel dataChannel = roomCall.dataChannel();



getVideoFilter()

Description

This method returns the instance of VideoFilter currently in use.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
VideoFilter videoFilter = roomCall.getVideoFilter();



setVideoFilter(videoFilter)

Description

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

Arguments

  • videoFilter: VideoFilter - An instance of VideoFilter.

Returns

  • N/A

Example

private void example() {
    VideoFilter videoFilter = createVideoFilter();
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    roomCall.setVideoFilter(videoFilter);
}



clearVideoFilter()

Description

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

Arguments

  • none

Returns

  • N/A

Example

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.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

private void example() {
    InfobipRTC infobipRTC = InfobipRTC.getInstance();
    RoomCall roomCall = infobipRTC.getActiveRoomCall();
    roomCall.leave();
}

Tutorials

Migration guides

Reference documentation

Clone this wiki locally