-
Notifications
You must be signed in to change notification settings - Fork 2
RoomCall
id(): stringoptions(): RoomCallOptionscustomData(): CustomDataname(): stringstatus(): CallStatusduration(): numberjoinTime(): DateleaveTime(): Datemute(shouldMute: boolean): Promise<void>muted(): booleanpauseIncomingVideo(): voidresumeIncomingVideo(): voidsendDTMF(dtmf: string): Promise<void>cameraVideo(cameraVideo: boolean): Promise<void>hasCameraVideo(): booleanscreenShare(screenShare: boolean): Promise<void>startScreenShare(displayOptions?: DisplayOptions): Promise<void>stopScreenShare(): Promise<void>hasScreenShare(): booleansetAudioInputDevice(deviceId: string): Promise<void>setVideoInputDevice(deviceId: string): Promise<void>audioFilter(): AudioFiltersetAudioFilter(audioFilter: AudioFilter): Promise<void>clearAudioFilter(): Promise<void>videoFilter(): VideoFiltersetVideoFilter(videoFilter: VideoFilter): Promise<void>clearVideoFilter(): Promise<void>localCapturer(): LocalCapturerserverCapturer(): ServerCapturerdataChannel(): DataChannelcameraOrientation(): CameraOrientationsetCameraOrientation(cameraOrientation: CameraOrientation): Promise<void>setAudioQualityMode(audioQualityMode: AudioQualityMode): voidaudioQualityMode(): AudioQualityModeleave(): voidon(event: CallsApiEvent, eventHandler: CallsEventHandlers): void
Returns a unique room call identifier on Infobip RTC platform.
none
-
string- Call ID.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
console.log(`Room call ID: ${roomCall.id()}`);Returns the options this room call was started with.
none
-
RoomCallOptions- Options that this room call was started with.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
console.log(`Room call options: ${JSON.stringify(roomCall.options())}`);Getter for the customData field.
none
-
CustomData- Value of thecustomDatafield that is defined as an object of key-valuestringpairs.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCallOptions = RoomCallOptions.builder().setCustomData({'city': 'New York'}).build();
let roomCall = infobipRTC.joinRoom('test_room', roomCallOptions);
console.log(`Custom data: ${JSON.stringify(roomCall.customData())}`);Returns the name of the room.
none
-
string- Name of the room.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
console.log(`Room name: ${roomCall.name()}`)Returns current status of the room call.
none
-
CallStatus- Call status.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
console.log(`Status: ${roomCall.status()}`);Returns the duration of the room call in seconds calculated from the time the room was joined. Initially, duration is 0.
none
-
number- Room call duration in seconds.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room');
roomCall.on('hangup', _ => {
let durationInSeconds = roomCall.duration();
let seconds = `${String(Math.floor(durationInSeconds % 60)).padStart(2, '0')}`;
let minutes = `${String(Math.floor(durationInSeconds / 60) % 60).padStart(2, '0')}`;
let hours = `${String(Math.floor(durationInSeconds / 3600)).padStart(2, '0')}`;
console.log(`Duration: ${hours}:${minutes}:${seconds}`);
});Returns the time when the participant joined the room.
none
-
Date- Time when the participant joined the room.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
console.log(`Join time: ${roomCall.joinTime()}`);
});Returns the time when the participant left the room.
none
-
Date- Time when the participant left the room.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_LEFT, _ => {
console.log(`Leave time: ${roomCall.leaveTime()}`);
});Toggles mute option.
-
shouldMute:boolean- Whether the audio should be muted after this action.
-
Promise<void>- Promise that resolves tovoid.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
roomCall.mute(true)
.catch(error => console.log(`Error: ${error}`));
});Returns information whether the audio is muted.
none
-
boolean-trueif audio is muted, otherwisefalse.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.roomCall('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
roomCall.mute(true);
let muted = roomCall.muted() ? "muted" : "not muted";
console.log(`Audio is ${muted}`);
});Stop receiving the video media of other room participants.
none
N/A
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
document.addEventListener("visibilitychange", () => {
if (document.visibilityState !== 'visible') {
console.log('Browser lost focus, stop showing remote video media.');
roomCall.pauseIncomingVideo()
.catch(error => console.log(`Error: ${error}`));
}
});
});Start receiving the video media of other room participants.
none
N/A
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
document.addEventListener("visibilitychange", () => {
if (document.visibilityState === 'visible') {
console.log('Browser regained focus, showing remote video media.');
roomCall.resumeIncomingVideo()
.catch(error => console.log(`Error: ${error}`));
}
});
});Simulates key-press by sending DTMF (Dual-Tone Multi-Frequency) entry.
-
dtmf:string- One of the allowed DTMF characters:- digits:
0to9 - letters:
AtoD - symbols:
*and#
- digits:
-
Promise<void>- Promise that resolves tovoid.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().builder());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
roomCall.sendDTMF('1')
.catch(error => console.log(`Error: ${error}`));
});Controls whether the local camera video should be enabled.
-
cameraVideo:boolean- Whether local camera video should be enabled.
-
Promise<void>- Promise that resolves tovoid.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
roomCall.cameraVideo(true)
.catch(error => console.log(`Error: ${error}`));
});Returns whether the local camera video is enabled.
none
-
boolean-trueif the room call has local camera video, otherwisefalse.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCallOptions = RoomCallOptions.builder().setVideo(true).build();
let roomCall = infobipRTC.joinRoom('test_room', roomCallOptions);
console.log(`Joining room ${roomCall.hasLocalVideo() ? 'with' : 'without'} video.`);Please note that this method is being deprecated. Instead, You can use the
startScreenShareandstopScreenSharemethods.
Toggles sharing the screen during the room call.
After one participant in the call starts sharing their screen, the screen-share-added event will be triggered on their side, and participant-screen-share-added event will be triggered for other participants in the call.
After one participant in the call stops sharing their screen, the screen-share-removed event will be triggered on their side, and participant-screen-share-removed event will be triggered for other participants in the call.
This method is not available in mobile versions of browsers.
-
screenShare:boolean- Controls whether the screen sharing should be started or stopped.
-
Promise<void>- Promise that resolves tovoid.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
roomCall.screenShare(true)
.catch(error => console.log(`Error: ${error}`));
});
roomCall.on(CallsApiEvent.SCREEN_SHARE_ADDED, _ => {
console.log('Started sharing screen');
})Starts sharing the screen during the call and optionally provides the ability to control surfaces which can be shared.
After one participant in the call starts sharing their screen, the screen-share-added event will be triggered on their side, and participant-screen-share-added event will be triggered for other participants in the call.
This method is not available in mobile versions of browsers.
Additionally, screenshare control is not available on all web browsers. Before attempting to use this feature, please consult the browser compatibility table.
-
displayOptions:DisplayOptions- Optional argument which provides control over surfaces that can be shared during the call. If not provided, no restrictions on display surfaces that can be shared are set.
-
Promise<void>- Promise that resolves tovoid.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
let displayOptions: DisplayOptions = {allowedDisplayOptions: ['window', 'monitor']}
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
roomCall.startScreenShare(displayOptions)
.catch(error => console.log(`Error: ${error}`));
});
roomCall.on(CallsApiEvent.SCREEN_SHARE_ADDED, _ => {
console.log('Started sharing screen');
})Stops sharing the screen during the call.
After one participant in the call stops sharing their screen, the screen-share-removed event will be triggered on their side, and participant-screen-share-removed event will be triggered for other participants in the call.
This method is not available in mobile versions of browsers.
none
-
Promise<void>- Promise that resolves tovoid.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.SCREEN_SHARE_ADDED, _ => {
roomCall.stopScreenShare()
.catch(error => console.log(`Error: ${error}`));
});
roomCall.on(CallsApiEvent.SCREEN_SHARE_REMOVED, _ => {
console.log('Stopped sharing screen');
})Returns information whether screen is being shared with remote peer.
none
-
boolean-trueif screen is being shared, otherwisefalse.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ESTABLISHED, _ => {
roomCall.screenShare(true)
.catch(error => console.log(`Error: ${error}`));
});
roomCall.on(CallsApiEvent.SCREEN_SHARE_ADDED, _ => {
if (roomCall.hasScreenShare()) {
console.log('Sharing screen...');
}
})Sets the audio input device with the given id to be used during the room call.
-
deviceId:string- Audio input device identifier.
-
Promise<void>- Promise that resolves tovoid.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
roomCall.setAudioInputDevice('audioDeviceId')
.catch(error => console.log(`Error: ${error}`));
});Sets the video input device with the given id to be used during the room call.
-
deviceId:string- Video input device identifier.
-
Promise<void>- Promise that resolves tovoid.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().setVideo(true).build());
roomCall.on(CallsApiEvent.ESTABLISHED, _ => {
roomCall.setVideoInputDevice('videoDeviceId')
.catch(error => console.log(`Error: ${error}`));
});Returns the audio filter being used during the room call.
none
-
AudioFilter- An object instance which implements theAudioFilterinterface.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.setAudioFilter(createAudioFilterImplementation());
let audioFilter = roomCall.audioFilter();Sets the audio filter to be used during the room call.
Passing null will remove and release any already existing audio filter.
-
audioFilter:AudioFilter- An object instance which implements theAudioFilterinterface.
-
Promise<void>- Promise that resolves once the filter has been applied to the current audio stream.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
let audioFilter = createAudioFilterImplementation();
roomCall.setAudioFilter(audioFilter);Convenience method that is used to remove the audio filter if it is present.
none
-
Promise<void>- Promise that resolves once the filter has been removed.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
let audioFilter = createAudioFilterImplementation();
roomCall.setAudioFilter(audioFilter);
roomCall.clearAudioFilter();Returns the video filter being used during the room call.
none
-
VideoFilter- An object instance which implements theVideoFilterinterface.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().setVideo(true).build());
roomCall.setVideoFilter(createVideoFilterImplementation());
let videoFilter = roomCall.videoFilter();Sets the video filter to be used during the video room call.
Passing null will remove and release any already existing video filter.
-
videoFilter:VideoFilter- An object instance which implements theVideoFilterinterface.
-
Promise<void>- Promise that resolves once the filter has been applied to the current video stream.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().setVideo(true).build());
let videoFilter = createVideoFilterImplementation();
roomCall.setVideoFilter(videoFilter);Convenience method that is used to remove the video filter if it is present.
none
-
Promise<void>- Promise that resolves once the filter has been removed.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().setVideo(true).build());
let videoFilter = createVideoFilterImplementation();
roomCall.setVideoFilter(videoFilter);
roomCall.clearVideoFilter();Gets an instance of LocalCapturer, which can be used to take screenshots of participant's videos
and download them directly to the machine.
none
-
LocalCapturer- Returns an instance of a capturer used for storing screenshots locally.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().setVideo(true).build());
let identity = "capture_test_identity";
let videoType = VideoType.CAMERA;
// we take a screenshot of the participant's camera, and download it to the local machine as a `.png` file
roomCall.localCapturer().takeScreenshot(identity, videoType)
.then(url => {
const link = document.createElement('a');
link.download = `${identity}_${videoType.toString().toLowerCase()}.png`;
link.href = url;
link.click();
link.remove();
});Gets an instance of ServerCapturer, which is used to upload screenshots of participants' videos to the cloud.
These screenshots can subsequently be retrieved using the WebRTC Files API.
none
-
ServerCapturer- Returns an instance of a capturer used for uploading screenshots to the cloud.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().setVideo(true).build());
let identity = "capture_test_identity";
let videoType = VideoType.SCREENSHARE;
// we take a screenshot of the participant's screen share, which is directly uploaded to the server (cloud)
applicationCall.serverCapturer().takeScreenshot(identity, videoType)
.then(fileResponse => {
console.log(`Screenshot uploaded to the server with id: ${fileResponse.id}, and name: ${fileResponse.name}`);
}).catch(err => {
console.log("There was an error uploading a screenshot to the server!");
});Gets an instance of DataChannel, that should be used to send and receive data during the current
room call.
none
-
DataChannel- Returns an instance of a data channel.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCalOptions.builder().setDataChannel(true).build());
roomCall.dataChannel().send("Hello world!")
.then(id => {
console.log(`Sent text with id: ${id}.`)
});Returns current camera orientation.
none
-
CameraOrientation- Enum value which corresponds to the camera orientation.
let videoOptions = VideoOptions.builder().setCameraOrientation(CameraOrientation.BACK).build();
let roomCallOptions = RoomCallOptions.builder().setVideo(true).setVideoOptions(videoOptions).build();
let roomCall = infobipRTC.joinRoom('test_room', roomCallOptions);
console.log(`Camera orientation is: ${roomCall.cameraOrientation()}`);Sets a local camera orientation to the given enum value.
-
CameraOrientation- Enum value which corresponds to the camera orientation.
-
Promise<void>- Promise that resolves tovoid.
let call = infobipRTC.joinRoom('test_room', RoomCallOptions.builder.setVideo(true).build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
roomCall.setCameraOrientation(CameraOrientation.BACK)
.catch(error => console.log(`Error: ${error}`));
});Sets the audio quality mode to a given enum value.
-
audioQualityMode- Enum value that corresponds to the audio quality mode.
N/A
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
roomCall.setAudioQualityMode(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.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
console.log(`Audio quality mode: ${roomCall.audioQualityMode()}`);Leaves the room call, and results in receiving
a CallsApiEvent.ROOM_LEFT event from the Infobip's platform.
none
N/A
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
roomCall.on(CallsApiEvent.ROOM_JOINED, _ => {
roomCall.leave();
});Configures the event handler for room call events.
-
eventName:CallsApiEvent- Name of the received event. -
eventHandler:CallsEventHandlers- Function that will be called when specified event occurs, with exactly one parameter being passed to the function containing event information. Depending on the event, the passed parameter will contain a set of fields that will describe the event, namely:-
ROOM_JOINED- Data containing room call information is received in the event object. It contains room call id, room name, array ofParticipantobjects representing the participants that are already in the room call, and theMediaStreamobject representing the media in the room call.event = { id: string, name: string, participants: Participant[], stream: MediaStream }
-
ROOM_LEFT- A receivedErrorCodeobject provides details about the reason for the participant leaving the call, along with aTotalMediaStatsobject that offers a comprehensive summary of the call's audio statistics.event = { errorCode: ErrorCode, totalMediaStats: TotalMediaStats }
-
ERROR- A receivedErrorCodeobject provides details about the reason for the error occurrence.event = { errorCode: ErrorCode }
-
CAMERA_VIDEO_ADDED- AMediaStreamobject representing the media in the call is received in the event object.event = { stream: MediaStream }
-
CAMERA_VIDEO_UPDATED- AMediaStreamobject representing the media in the call is received in the event object.event = { stream: MediaStream }
-
CAMERA_VIDEO_REMOVED- No additional data is provided in the event object.event = {}
-
SCREEN_SHARE_ADDED- AMediaStreamobject representing the media in the call is received in the event object.event = { stream: MediaStream }
-
SCREEN_SHARE_REMOVED- AVideoRemovalReasonenum value giving additional info on the reason for removing the screen share.event = { reason: VideoRemovalReason }
-
PARTICIPANT_JOINING- AParticipantobject representing the participant joining the roomCall.event = { participant: Participant }
-
PARTICIPANT_JOINED- AParticipantobject representing the participant that joined the roomCall.event = { participant: Participant }
-
PARTICIPANT_MUTED- AParticipantobject representing the participant that was muted.event = { participant: Participant }
-
PARTICIPANT_UNMUTED- AParticipantobject representing the participant that was unmuted.event = { participant: Participant }
-
PARTICIPANT_DEAF- AParticipantobject representing the participant that was deafened.event = { participant: Participant }
-
PARTICIPANT_UNDEAF- AParticipantobject representing the participant that was undeafened.event = { participant: Participant }
-
PARTICIPANT_BLINDED- AParticipantobject representing the participant that was blinded.event = { participant: Participant }
-
PARTICIPANT_UNBLINDED- AParticipantobject representing the participant that was unblinded.event = { participant: Participant }
-
TALKING_WHILE_MUTED- No additional data is provided in the event object.event = {}
-
STARTED_TALKING- No additional data is provided in the event object.event = {}
-
STOPPED_TALKING- No additional data is provided in the event object.event = {}
-
PARTICIPANT_STARTED_TALKING- AParticipantobject representing the participant that started talking.event = { participant: Participant }
-
PARTICIPANT_STOPPED_TALKING- AParticipantobject representing the participant that stopped talking.event = { participant: Participant }
-
PARTICIPANT_LEFT- AParticipantobject representing the participant that left the roomCall.event = { participant: Participant }
-
PARTICIPANT_CAMERA_VIDEO_ADDED- AParticipantandMediaStreamobject representing the participant and their camera video stream.event = { participant: Participant, stream: MediaStream }
-
PARTICIPANT_CAMERA_VIDEO_REMOVED- AParticipantobject representing the participant that removed their camera video.event = { participant: Participant }
-
PARTICIPANT_SCREEN_SHARE_ADDED- AParticipantandMediaStreamobject representing the participant and their screen share stream.event = { participant: Participant, stream: MediaStream }
-
PARTICIPANT_SCREEN_SHARE_REMOVED- AParticipantobject representing the participant that removed their screen share.event = { participant: Participant }
-
RECONNECTING- No additional data is provided in the event object.event = {}
-
RECONNECTED- No additional data is provided in the event object.event = {}
-
PARTICIPANT_DISCONNECTED- AParticipantobject representing the participant that disconnected.event = { participant: Participant }
-
PARTICIPANT_RECONNECTED- AParticipantobject representing the participant that reconnected.event = { participant: Participant }
-
NETWORK_QUALITY_CHANGED- An event containing a NetworkQuality and a CurrentMediaStats objects that provides details on the network quality of a local participant and its corresponding media stats.event = { networkQuality: NetworkQuality, currentMediaStats: CurrentMediaStats }
-
PARTICIPANT_NETWORK_QUALITY_CHANGED- An event containing a NetworkQuality and a Participant objects that provides details on the network quality specifically for a given participant.event = { participant: Participant, networkQuality: NetworkQuality }
-
ROOM_RECORDING_STARTED- An event that is triggered once a Room recording starts. It includes RecordingType enum value which corresponds to the type of recording initiated.event = { recordingType: RecordingType }
-
N/A
Let's assume you have an audio HTML element with the id remoteAudio and video HTML elements with the ids localVideo
and localScreenShare.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder()
.setAutoReconnect(true) // Required in order to receive RECONNECT and RECONNECTED events
.build());
roomCall.on(CallsApiEvent.ROOM_JOINED, function (event) {
$('#remoteAudio').srcObject = event.stream;
var participants = event.participants.map(participant => participant.endpoint.identifier).join(", ");
console.log(`You have joined the room with ${event.participants.length} more participants: ${participants}`);
});
roomCall.on(CallsApiEvent.ROOM_LEFT, function (event) {
console.log(`You have left the room with error code: ${event.errorCode.name}.`);
});
roomCall.on(CallsApiEvent.ERROR, function (event) {
console.log(`Error! ${event.errorCode.name}`);
});
roomCall.on(CallsApiEvent.PARTICIPANT_JOINED, function (event) {
console.log(`${event.participant.endpoint.identifier} joined the room call.`);
});
roomCall.on(CallsApiEvent.PARTICIPANT_LEFT, function (event) {
console.log(`${event.participant.endpoint.identifier} left the room call.`);
});
roomCall.on(CallsApiEvent.PARTICIPANT_MUTED, function (event) {
console.log(`${event.participant.endpoint.identifier} muted.`);
});
roomCall.on(CallsApiEvent.PARTICIPANT_UNMUTED, function (event) {
console.log(`${event.participant.endpoint.identifier} unmuted.`);
});
roomCall.on(CallsApiEvent.TALKING_WHILE_MUTED, function (event) {
console.log('You are talking while muted. Do you want to unmute?');
});
roomCall.on(CallsApiEvent.STARTED_TALKING, function (event) {
console.log('You started talking!');
});
roomCall.on(CallsApiEvent.STOPPED_TALKING, function (event) {
console.log('You stopped talking!');
});
roomCall.on(CallsApiEvent.CAMERA_VIDEO_ADDED, function (event) {
$('#localVideo').srcObject = event.stream;
});
roomCall.on(CallsApiEvent.CAMERA_VIDEO_UPDATED, function (event) {
$('#localVideo').srcObject = event.stream;
});
roomCall.on(CallsApiEvent.CAMERA_VIDEO_REMOVED, function (event) {
$('#localVideo').srcObject = null;
});
roomCall.on(CallsApiEvent.SCREEN_SHARE_ADDED, function (event) {
$('#localScreenShare').srcObject = event.stream;
});
roomCall.on(CallsApiEvent.SCREEN_SHARE_REMOVED, function (event) {
$('#localScreenShare').srcObject = null;
});
roomCall.on(CallsApiEvent.RECONNECTING, function (event) {
console.log('Room call is being reconnected, hang tight!');
})
roomCall.on(CallsApiEvent.RECONNECTED, function (event) {
console.log(`You have successfully reconnected the call!`);
});
roomCall.on(CallsApiEvent.PARTICIPANT_DISCONNECTED, function (event) {
console.log(`Participant ${event.participant.endpoint.identifier} has disconnected!`);
});
roomCall.on(CallsApiEvent.PARTICIPANT_RECONNECTED, function (event) {
console.log(`Participant ${event.participant.endpoint.identifier} has reconnected!`);
});
roomCall.on(CallsApiEvent.NETWORK_QUALITY_CHANGED, (event) => {
console.log(`Local network quality: ${NetworkQuality[event.networkQuality]}`);
});
roomCall.on(CallsApiEvent.PARTICIPANT_NETWORK_QUALITY_CHANGED, (event) => {
console.log(`Network quality of ${event.participant.endpoint.identifier}: ${NetworkQuality[event.networkQuality]}`);
});
roomCall.on(CallsApiEvent.ROOM_RECORDING_STARTED, (event) => {
console.log(`Room recording started with type ${event.recordingType}`);
});