-
Notifications
You must be signed in to change notification settings - Fork 2
RoomCall
String id()
RoomCallOptions options()
CallStatus status()
String name()
int duration()
Date joinTime()
Date leaveTime()
List<Participant> participants()
Map<String, RemoteVideo> remoteVideos()
void mute(boolean shouldMute) throws ActionFailedException
boolean muted()
void speakerphone(boolean enabled)
boolean speakerphone()
void sendDTMF(String dtmf) throws ActionFailedException
void cameraVideo(boolean cameraVideo) throws ActionFailedException
boolean hasCameraVideo()
void startScreenShare(ScreenCapturer screenCapturer) throws ActionFailedException
void resetScreenShare()
void stopScreenShare() throws ActionFailedException
boolean hasScreenShare()
RTCVideoTrack localCameraTrack()
RTCVideoTrack localScreenShareTrack()
void setEventListener(RoomCallEventListener roomCallEventListener)
RoomCallEventListener getEventListener()
void cameraOrientation(VideoOptions.CameraOrientation cameraOrientation
VideoOptions.CameraOrientation cameraOrientation()
void pauseIncomingVideo() throws ActionFailedException
void resumeIncomingVideo() throws ActionFailedException
void setNetworkQualityEventListener(NetworkQualityEventListener networkQualityEventListener)
NetworkQualityEventListener getNetworkQualityEventListener()
void setParticipantNetworkQualityEventListener(ParticipantNetworkQualityEventListener participantNetworkQualityEventListener)
ParticipantNetworkQualityEventListener getParticipantNetworkQualityEventListener()
AudioDeviceManager audioDeviceManager()
void audioQualityMode(AudioOptions.AudioQualityMode audioQualityMode)
AudioOptions.AudioQualityMode audioQualityMode()
DataChannel dataChannel()
VideoFilter getVideoFilter()
void setVideoFilter(VideoFilter videoFilter)
void clearVideoFilter()
void leave()
Returns a unique call identifier.
none
-
String
- Call ID.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
String id = roomCall.id();
Getter for the options
field.
none
-
RoomCallOptions
- The value of theoptions
field representing the call options which the room is joined with.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
RoomCallOptions roomCallOptions = roomCall.options();
Returns current call status.
none
-
CallStatus
- The value of thestatus
field representing the status of the call.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
CallStatus status = roomCall.status();
Returns a room name.
none
-
String
- The value of thename
field representing a room name chosen by a room creator.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
String name = roomCall.name();
Returns call duration in seconds calculated from the time of joining a room. Initially, duration is 0
.
none
-
int
- Call duration
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
int callDuration = roomCall.duration();
Returns time when the user joined the room. Initially, joinTime is null
.
none
-
Date
- Time when user joined the room
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
Date joinTime = roomCall.joinTime();
Returns time when the user left the room. Initially, joinTime is null
.
none
-
Date
- Time when user left the room
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
Date leaveTime = roomCall.leaveTime();
Returns the list of participants currently present in the room.
none
-
List<Participant>
- List of participants.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
List<Participant> participants = roomCall.participants();
Returns a map of other participants' videos who currently have their video(s) enabled in the room.
none
-
Map<String, RemoteVideo>
- Map that contains remote videos as values and participants' identifiers as keys.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
Map<String, RemoteVideo> remoteVideos = roomCall.remoteVideos();
Controls whether the user's audio in the room call should be muted after this action. Disabled by default.
-
shouldMute
:boolean
-true
if the audio should be muted, otherwisefalse
.
N/A
-
ActionFailedException
- if muting fails for any reason.
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()));
}
}
Returns information whether the user's audio in the room is muted.
none
-
boolean
- trueif the audio is muted, otherwise
false`.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
boolean muted = roomCall.muted();
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.
-
enabled
:boolean
-true
if the audio should be played on speakerphone, otherwisefalse
.
N/A
private void example() {
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.speakerphone(true);
}
Returns information whether speakerphone is enabled or not.
none
-
boolean
-true
if the speakerphone is enabled, otherwisefalse
.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
boolean speakerphone = 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
-
ActionFailedException
- if sending DTMF fails for any reason.
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()));
}
}
Controls whether the local camera video should be enabled.
-
cameraVideo
:boolean
- Whether camera video should be enabled or not.
N/A
-
ActionFailedException
-true
if local camera video should be enabled, otherwisefalse
.
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()));
}
}
Returns information whether the user has local camera video enabled.
none
-
boolean
-true
if the user has local camera video enabled, otherwisefalse
.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
boolean hasCameraVideo = roomCall.hasCameraVideo();
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.
-
screenCapturer
:ScreenCapturer
- Screen capturer used for sharing.
N/A
-
ActionFailedException
- if starting screen share fails for any reason.
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);
}
}
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.
none
N/A
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();
}
}
}
Stops sharing screen with the room.
none
N/A
-
ActionFailedException
- if stopping screen share fails for any reason.
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()));
}
}
Returns information whether the user has local screen share video enabled.
none
-
boolean
-true
if the user has local screen share video enabled, otherwisefalse
.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
boolean hasScreenShare = roomCall.hasScreenShare();
Returns video track for local camera video.
none
-
RTCVideoTrack
- Video track representing local camera stream.null
if there is no local camera video.
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);
}
}
Returns video track for local screen share.
none
-
RTCVideoTrack
- Video track representing local screen share stream.null
if there is no local screen share.
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);
}
}
Configures event handler for room call events.
-
roomCallEventListener
:RoomCallEventListener
- Interface with event methods that should be implemented, method per room call event to be handled.
N/A
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);
}
});
}
Returns event handler for room call events.
none
-
RoomCallEventListener
- Interface that should be implemented in order to handle room call events properly.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
RoomCallEventListener roomCallEventListener = roomCall.getEventListener();
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
.
-
none
:VideoOptions.CameraOrientation
- Camera facing mode.
N/A
private void example() {
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.cameraOrientation(VideoOptions.CameraOrientation.BACK);
}
Returns the current camera facing mode.
none
-
VideoOptions.CameraOrientation
- Camera facing mode.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
VideoOptions.CameraOrientation cameraOrientation = roomCall.cameraOrientation();
Pauses incoming video media.
none
N/A
-
ActionFailedException
- if a method is called while the call is in the process of reconnecting.
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()));
}
}
Resumes incoming video media.
none
N/A
-
ActionFailedException
- if a method is called while the call is in the process of reconnecting.
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()));
}
}
Configures event handler for local network quality events.
-
networkQualityEventListener
:networkQualityEventListener
- Interface that should be implemented in order to handle local network quality events properly.
N/A
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()));
});
}
Returns event handler for local network quality events.
none
-
NetworkQualityEventListener
- Interface that should be implemented in order to handle local network quality events properly.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
NetworkQualityEventListner networkQualityEventListner = roomCall.getNetworkQualityEventListener();
Configures event handler for other participant's network quality events.
-
participantNetworkQualityEventListener
:ParticipantNetworkQualityEventListener
- Interface that should be implemented in order to handle other participant's network quality events properly.
N/A
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()));
});
}
Returns event handler for other participant's network quality events.
none
-
ParticipantNetworkQualityEventListener
- An interface that should be implemented in order to handle other participant's network quality events properly.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
ParticipantNetworkQualityEventListener participantNetworkQualityEventListener = roomCall.getParticipantNetworkQualityEventListener();
Returns the instance of AudioDeviceManager
that should be used to manage the audio devices in
the current call.
none
-
AudioDeviceManager
- An instance ofAudioDeviceManager
specifically designed for handling audio devices.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
AudioDeviceManager audioDeviceManager = roomCall.audioDeviceManager();
Sets the audio quality mode to a given enum value.
-
audioQualityMode
:AudioOptions.AudioQualityMode
- Enum value that corresponds to the audio quality mode.
N/A
private void example() {
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.audioQualityMode(AudioOptions.AudioQualityMode.LOW_DATA);
}
Returns the audio quality mode that is used during the call.
none
-
AudioQualityMode
- Enum value that corresponds to the audio quality mode.
private void example() {
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
AudioOptions.AudioQualityMode audioQualityMode = roomCall.audioQualityMode();
}
Returns the instance of DataChannel
that should be used to send and receive data during the current
call.
none
-
DataChannel
- An instance ofDataChannel
specifically designed for handling actions on data channel.null
if data channel is not enabled in call options.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
DataChannel dataChannel = roomCall.dataChannel();
This method returns the instance of VideoFilter
currently in use.
none
-
VideoFilter
- An instance ofVideoFilter
.
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
VideoFilter videoFilter = roomCall.getVideoFilter();
This method sets the video filter to be used during the video call. Passing null
will remove and release any already
existing video filter.
-
videoFilter
:VideoFilter
- An instance ofVideoFilter
.
N/A
private void example() {
VideoFilter videoFilter = createVideoFilter();
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.setVideoFilter(videoFilter);
}
This convenience method removes the video filter if it is present.
none
N/A
private void example() {
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.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
private void example() {
InfobipRTC infobipRTC = InfobipRTC.getInstance();
RoomCall roomCall = infobipRTC.getActiveRoomCall();
roomCall.leave();
}