Skip to content

RoomCall

Lejla Solak edited this page May 27, 2024 · 12 revisions



id()

Description

Returns a unique call identifier.

Arguments

  • none

Returns

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
Toast.makeText(getApplicationContext(), "Call ID: " + roomCall.id(), Toast.LENGTH_LONG);



options()

Description

Getter for the options field.

Arguments

  • none

Returns

  • RoomCallOptions - 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();
Toast.makeText(getApplicationContext(), "Call options: " + roomCallOptions, Toast.LENGTH_LONG);



status()

Description

Returns current call status.

Arguments

  • none

Returns

  • CallStatus - Value of the status field representing the status of the call.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
CallStatus status = roomCall.status();
Toast.makeText(getApplicationContext(), "Call status: " + status, Toast.LENGTH_LONG);



name()

Description

Returns a room name.

Arguments

  • none

Returns

  • String - 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();
Toast.makeText(getApplicationContext(), "Room name: " + name, Toast.LENGTH_LONG);



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 duration = roomCall.duration();
Toast.makeText(getApplicationContext(), "Call duration: " + duration, Toast.LENGTH_LONG);



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();
Toast.makeText(getApplicationContext(), "Call duration: " + joinTime, Toast.LENGTH_LONG);



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();
Toast.makeText(getApplicationContext(), "Call duration: " + leaveTime, Toast.LENGTH_LONG);



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

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.mute(true);



muted()

Description

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

Arguments

  • none

Returns

  • boolean - trueif the audio is muted, otherwisefalse`.

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
String muted = roomCall.muted() ? "muted" : "not muted";
Toast.makeText(getApplicationContext(), "Audio is " + muted , Toast.LENGTH_LONG);



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

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();
String speakerphoneOn = roomCall.speakerphone() ? "on" : "off"; 
Toast.makeText(getApplicationContext(), "Speakerphone is " + speakerphoneOn, Toast.LENGTH_LONG);



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

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.sendDTMF("7");



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

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.cameraVideo(true);



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.

Arguments

Returns

  • N/A

Throws

Example

public class Foo extends AppCompatActivity {
    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode != 1) {
            return;
        }

        ScreenCapturer screenCapturer = new ScreenCapturer(resultCode, data);
        InfobipRTC infobipRTC = InfobipRTC.getInstance();
        RoomCall roomCall = infobipRTC.getActiveRoomCall();
        roomCall.startScreenShare(screenCapturer);
    }
}



stopScreenShare()

Description

Stops sharing screen with the room.

Arguments

  • none

Returns

  • N/A

Throws

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.stopScreenShare();



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();
Log.d("WebRTC", String.format("Has screen share: %s", 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

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
RTCVideoTrack localCamera = roomCall.localCameraTrack();
if (localCamera != null) {
    localCamera.addSink(localVideoRenderer);
}



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

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
RTCVideoTrack localScreenShare = roomCall.localScreenShareTrack();
if (localScreenShare != null) {
    localScreenShare.addSink(localVideoRenderer);
}



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

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



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

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();
String cameraOrientation = roomCall.cameraOrientation().name();
Toast.makeText(getApplicationContext(), "Camera orientation is " + cameraOrientation, Toast.LENGTH_LONG);



pauseIncomingVideo()

Description

Pauses incoming video media.

Arguments

  • none

Returns

  • N/A

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.pauseIncomingVideo();



resumeIncomingVideo()

Description

Resumes incoming video media.

Arguments

  • none

Returns

  • N/A

Example

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.resumeIncomingVideo();



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

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.setNetworkQualityEventListener(new NetworkQualityEventListener() {
    @Override
    public void onNetworkQualityChanged(NetworkQualityChangedEvent networkQualityChangedEvent) {
        NetworkQuality networkQuality = networkQualityChangedEvent.getNetworkQuality();
        Log.d("WebRTC", 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

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.setParticipantNetworkQualityEventListener(new ParticipantNetworkQualityEventListener() {
    @Override
    public void onParticipantNetworkQualityChanged(ParticipantNetworkQualityChangedEvent participantNetworkQualityChangedEvent) {
        Participant participant = participantNetworkQualityChangedEvent.getParticipant();
        NetworkQuality networkQuality = participantNetworkQualityChangedEvent.getNetworkQuality();
        Log.d("WebRTC",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

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.audioQualityMode(AudioOptions.AudioQualityMode.LOW_DATA);



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

// Retrieve the active room call and get the video filter
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

// Create a video filter
VideoFilter videoFilter = createVideoFilter();

// Set the video filter for the active room call
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

// Clear the video filter for the active room call
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

InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.leave();

Tutorials

Migration guides

Reference documentation

Clone this wiki locally