Skip to content

RoomCall

Kenan Genjac edited this page Jun 28, 2024 · 3 revisions



id()

Description

Returns a unique room call identifier on Infobip RTC platform.

Arguments

  • none

Returns

Example

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



options()

Description

Returns the options this room call was started with.

Arguments

  • none

Returns

Example

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



customData()

Description

Getter for the customData field.

Arguments

  • none

Returns

  • CustomData - Value of the customData field that is defined as an object of key-value string pairs.

Example

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



name()

Description

Returns the name of the room.

Arguments

  • none

Returns

Example

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



status()

Description

Returns current status of the room call.

Arguments

  • none

Returns

Example

let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let roomCall = infobipRTC.joinRoom('test_room', RoomCallOptions.builder().build());
console.log(`Status: ${roomCall.status()}`);



duration()

Description

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

Arguments

  • none

Returns

  • number - Room call duration in seconds.

Example

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



joinTime()

Description

Returns the time when the participant joined the room.

Arguments

  • none

Returns

  • Date - Time when the participant joined the room.

Example

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



leaveTime()

Description

Returns the time when the participant left the room.

Arguments

  • none

Returns

  • Date - Time when the participant left the room.

Example

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



mute(shouldMute)

Description

Toggles mute option.

Arguments

  • shouldMute: boolean - Whether the audio should be muted after this action.

Returns

Example

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



muted()

Description

Returns information whether the audio is muted.

Arguments

  • none

Returns

  • boolean - true if audio is muted, otherwise false.

Example

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



pauseIncomingVideo()

Description

Stop receiving the video media of other room participants.

Arguments

  • none

Returns

  • N/A

Example

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



resumeIncomingVideo()

Description

Start receiving the video media of other room participants.

Arguments

  • none

Returns

  • N/A

Example

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



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

Example

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



cameraVideo(cameraVideo)

Description

Controls whether the local camera video should be enabled.

Arguments

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

Returns

Example

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



hasCameraVideo()

Description

Returns whether the local camera video is enabled.

Arguments

  • none

Returns

  • boolean - true if the room call has local camera video, otherwise false.

Example

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.`);



screenShare(screenShare)

Please note that this method is being deprecated. Instead, You can use the startScreenShare and stopScreenShare methods.

Description

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.

Arguments

  • screenShare: boolean - Controls whether the screen sharing should be started or stopped.

Returns

Example

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



startScreenShare(displayOptions)

Description

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.

Arguments

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

Returns

Example

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



stopScreenShare()

Description

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.

Arguments

  • none

Returns

Example

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



hasScreenShare()

Description

Returns information whether screen is being shared with remote peer.

Arguments

  • none

Returns

  • boolean - true if screen is being shared, otherwise false.

Example

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);
});
roomCall.on(CallsApiEvent.SCREEN_SHARE_ADDED, _ => {
    if (roomCall.hasScreenShare()) {
        console.log('Sharing screen...');
    }
})



setAudioInputDevice(deviceId)

Description

Sets the audio input device with the given id to be used during the room call.

Arguments

  • deviceId: string - Audio input device identifier.

Returns

Example

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



setVideoInputDevice(deviceId)

Description

Sets the video input device with the given id to be used during the room call.

Arguments

  • deviceId: string - Video input device identifier.

Returns

Example

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



audioFilter()

Description

Returns the audio filter being used during the room call.

Arguments

  • none

Returns

  • AudioFilter - An object instance which implements the AudioFilter interface.

Example

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



setAudioFilter(audioFilter)

Description

Sets the audio filter to be used during the room call. Passing null will remove and release any already existing audio filter.

Arguments

  • audioFilter: AudioFilter - An object instance which implements the AudioFilter interface.

Returns

  • Promise<void> - Promise that resolves once the filter has been applied to the current audio stream.

Example

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



clearAudioFilter()

Description

Convenience method that is used to remove the audio filter if it is present.

Arguments

  • none

Returns

  • Promise<void> - Promise that resolves once the filter has been removed.

Example

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



videoFilter()

Description

Returns the video filter being used during the room call.

Arguments

  • none

Returns

  • VideoFilter - An object instance which implements the VideoFilter interface.

Example

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



setVideoFilter(videoFilter)

Description

Sets the video filter to be used during the video room call. Passing null will remove and release any already existing video filter.

Arguments

  • videoFilter: VideoFilter - An object instance which implements the VideoFilter interface.

Returns

  • Promise<void> - Promise that resolves once the filter has been applied to the current video stream.

Example

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



clearVideoFilter()

Description

Convenience method that is used to remove the video filter if it is present.

Arguments

  • none

Returns

  • Promise<void> - Promise that resolves once the filter has been removed.

Example

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



localCapturer()

Description

Gets an instance of LocalCapturer, which can be used to take screenshots of participant's videos and download them directly to the machine.

Arguments

  • none

Returns

  • LocalCapturer - Returns an instance of a capturer used for storing screenshots locally.

Example

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



serverCapturer()

Description

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.

Arguments

  • none

Returns

  • ServerCapturer - Returns an instance of a capturer used for uploading screenshots to the cloud.

Example

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



dataChannel()

Description

Gets an instance of DataChannel, that should be used to send and receive data during the current room call.

Arguments

  • none

Returns

Example

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



cameraOrientation()

Description

Returns current camera orientation.

Arguments

  • none

Returns

Example

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



setCameraOrientation(cameraOrientation)

Description

Sets a local camera orientation to the given enum value.

Arguments

Returns

Example

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



audioQualityMode(audioQualityMode)

Description

Sets the audio quality mode to a given enum value.

Arguments

Returns

  • N/A

Example

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.audioQualityMode(AudioQualityMode.LOW_DATA)
});



leave()

Description

Leaves the room call, and results in receiving a CallsApiEvent.ROOM_LEFT event from the Infobip's platform.

Arguments

  • none

Returns

  • N/A

Example

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



on(eventName, eventHandler)

Description

Configures the event handler for room call events.

Arguments

  • 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 of Participant objects representing the participants that are already in the room call, and the MediaStream object representing the media in the room call.

      event = { id: string, name: string, participants: Participant[], stream: MediaStream }
    • ROOM_LEFT - A received ErrorCode object provides details about the reason for the participant leaving the call, along with a TotalMediaStats object that offers a comprehensive summary of the call's audio statistics.

      event = { errorCode: ErrorCode, totalMediaStats: TotalMediaStats }
    • ERROR - A received ErrorCode object provides details about the reason for the error occurrence.

      event = { errorCode: ErrorCode }
    • CAMERA_VIDEO_ADDED - A MediaStream object representing the media in the call is received in the event object.

      event = { stream: MediaStream }
    • CAMERA_VIDEO_UPDATED - A MediaStream object 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 - A MediaStream object representing the media in the call is received in the event object.

      event = { stream: MediaStream }
    • SCREEN_SHARE_REMOVED - A VideoRemovalReason enum value giving additional info on the reason for removing the screen share.

      event = { reason: VideoRemovalReason }
    • PARTICIPANT_JOINING - A Participant object representing the participant joining the roomCall.

      event = { participant: Participant }
    • PARTICIPANT_JOINED - A Participant object representing the participant that joined the roomCall.

      event = { participant: Participant }
    • PARTICIPANT_MUTED - A Participant object representing the participant that was muted.

      event = { participant: Participant }
    • PARTICIPANT_UNMUTED - A Participant object representing the participant that was unmuted.

      event = { participant: Participant }
    • PARTICIPANT_DEAF - A Participant object representing the participant that was deafened.

      event = { participant: Participant }
    • PARTICIPANT_UNDEAF - A Participant object representing the participant that was undeafened.

      event = { participant: Participant }
    • PARTICIPANT_STARTED_TALKING - A Participant object representing the participant that started talking.

      event = { participant: Participant }
    • PARTICIPANT_STOPPED_TALKING - A Participant object representing the participant that stopped talking.

      event = { participant: Participant }
    • PARTICIPANT_LEFT - A Participant object representing the participant that left the roomCall.

      event = { participant: Participant }
    • PARTICIPANT_CAMERA_VIDEO_ADDED - A Participant and MediaStream object representing the participant and their camera video stream.

      event = { participant: Participant, stream: MediaStream }
    • PARTICIPANT_CAMERA_VIDEO_REMOVED - A Participant object representing the participant that removed their camera video.

      event = { participant: Participant }
    • PARTICIPANT_SCREEN_SHARE_ADDED - A Participant and MediaStream object representing the participant and their screen share stream.

      event = { participant: Participant, stream: MediaStream }
    • PARTICIPANT_SCREEN_SHARE_REMOVED - A Participant object representing the participant that removed their screen share.

      event = { participant: Participant }
    • ROOM_REJOINING - No additional data is provided in the event object.

      event = {}
    • ROOM_REJOINED - Data containing rejoined room call information is received in the event object. It contains room call id, room name, array of Participant objects representing the participants that are already in the room call, and the MediaStream object representing the media in the reconnected room call.

      event = { id: string, name: string, participants: Participant[], stream: MediaStream }
    • 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 object which details the type of recording initiated.

      event = { recordingType: RecordingType }

Returns

  • N/A

Example

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()
        .setAutoRejoin(true) // Required in order to receive ROOM_REJOINING and ROOM_REJOINED 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.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.ROOM_REJOINING, function (event) {
    console.log('Room call is being rejoined, hang tight!');
})

roomCall.on(CallsApiEvent.ROOM_REJOINED, function (event) {
  $('#remoteAudio').srcObject = event.stream;
  var participants = event.participants.map(participant => participant.endpoint.identifier).join(", ");
  console.log(`You have successfully rejoined the room with ${event.participants.length} participants: ${participants}!`);
});

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

Tutorials

Migration guides

Reference documentation

Clone this wiki locally