-
Notifications
You must be signed in to change notification settings - Fork 2
ApplicationCall
id(): Stringoptions(): ApplicationCallOptionscustomData(): CustomDatastatus(): CallStatusduration(): numberstartTime(): DateestablishTime(): DateendTime(): DatecallsConfigurationId(): Stringmute(shouldMute: boolean): Promise<void>muted(): booleansendDTMF(dtmf: String): Promise<void>pauseIncomingVideo(): void;resumeIncomingVideo(): 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>)setAudioFilter(audioFilter: AudioFilter): Promise<void>clearAudioFilter(): Promise<void>setVideoFilter(videoFilter: VideoFilter): Promise<void>clearVideoFilter(): Promise<void>localCapturer(): LocalCapturerserverCapturer(): ServerCapturerdataChannel(): DataChannelcameraOrientation(): CameraOrientationsetCameraOrientation(cameraOrientation: CameraOrientation): Promise<void>setAudioQualityMode(audioQualityMode: AudioQualityMode): voidaudioQualityMode(): AudioQualityModehangup(): voidrecordingState(): RecordingStateon(applicationCallApiEvent: CallsApiEvent, eventHandler: CallsEventHandlers): void
Returns a unique call identifier.
none
-
string- Call ID.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
console.log(`Call ID: ${applicationCall.id()}`);Returns the call options this call was started with.
none
-
ApplicationCallOptions- Call options the call was started with.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', ApplicationCallOptions.builder().build());
console.log(`Call options: ${JSON.stringify(applicationCall.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 applicationCallOptions = ApplicationCallOptions.builder().setCustomData({'city': 'New York'}).build();
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', applicationCallOptions);
console.log(`Custom data: ${JSON.stringify(applicationCall.customData())}`);Returns current call status.
none
-
CallStatus- Call status.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
console.log(`Call status: ${applicationCall.status()}`);Returns call duration in seconds calculated from the time call was established. Initially, duration is 0.
N/A
-
number- Call duration in seconds.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.HANGUP, _ => {
let durationInSeconds = applicationCall.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 call started (but not yet established). Initially, startTime is undefined.
none
-
Date- Time when the call started.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
console.log(`Start time: ${applicationCall.startTime()}`);Returns the time when the call was established. Initially, establishTime is undefined.
none
-
Date- Time when the call was established.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
console.log(`Establish time: ${applicationCall.establishTime()}`);
});Returns the time when the call finished. Initially, endTime is undefined.
none
-
Date- Time when the call finished.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.hangup();
});
applicationCall.on(CallsApiEvent.HANGUP, _ => {
console.log(`End time: ${applicationCall.endTime()}`);
});Returns a unique Calls Configuration identifier associated with your Calls Configuration logical entity created through our Calls API.
none
-
string- Represents theCalls Configuration IDwhich is configured using theCalls Configuration API.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
console.log(`Calls Configuration ID: ${applicationCall.callsConfigurationId()}`);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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.mute(true);
let muted = applicationCall.muted() ? 'muted' : 'not muted';
console.log(`Audio is ${muted}`);
});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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.sendDTMF('1')
.catch(error => console.log(`Error: ${error}`));
});Stop receiving the video media of other participants.
none
N/A
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
document.addEventListener('visibilitychange', () => {
if (document.visibilityState !== 'visible') {
console.log('Browser lost focus, stop showing remote video media.');
applicationCall.pauseIncomingVideo()
.catch(error => console.log(`Error: ${error}`));
}
});
});Start receiving the video media of other participants.
none
N/A
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
document.addEventListener('visibilitychange', () => {
if (document.visibilityState === 'visible') {
console.log('Browser got focus back, start showing remote video media again.');
applicationCall.resumeIncomingVideo()
.catch(error => console.log(`Error: ${error}`));
}
});
});Controls whether the local camera video should be enabled. For video calls it is enabled by default.
-
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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.cameraVideo(true)
.catch(error => console.log(`Error: ${error}`));
});Returns information whether the current call has local camera video.
none
-
boolean-trueif the call has local camera video, otherwisefalse.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCallOptions = ApplicationCallOptions.builder().setVideo(true).build();
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', applicationCallOptions);
let callType = applicationCall.hasLocalVideo() ? 'video' : 'audio';
console.log(`Making ${callType} application call.`);Please note that this method has been deprecated. Instead, you should use the
startScreenShareandstopScreenSharemethods.
Toggles sharing the screen during the 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 the other side.
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 the other side.
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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.screenShare(true)
.catch(error => console.log(`Error: ${error}`));
});
applicationCall.on(CallsApiEvent.SCREEN_SHARE_ADDED, _ => {
console.log('Started sharing screen');
})Starts sharing the screen during the call and optionally controls the type of display 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 the other side.
This method is not available in mobile versions of browsers.
Note that the screenshare control through the DisplayOptions is not supported 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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
let displayOptions: DisplayOptions = {allowedDisplayOptions: ['window', 'monitor']}
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.startScreenShare(displayOptions)
.catch(error => console.log(`Error: ${error}`));
});
applicationCall.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 the other side.
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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.SCREEN_SHARE_ADDED, _ => {
applicationCall.stopScreenShare()
.catch(error => console.log(`Error: ${error}`));
});
applicationCall.on(CallsApiEvent.SCREEN_SHARE_REMOVED, _ => {
console.log('Stopped sharing screen');
})Returns information whether screen is being shared with remote peer.
none
-
boolean-trueif the screen is being shared, otherwisefalse.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.screenShare(true);
});
applicationCall.on(CallsApiEvent.SCREEN_SHARE_ADDED, _ => {
if (applicationCall.hasScreenShare()) {
console.log('Sharing screen...');
}
})Sets the audio input device with the given id to be used during the call.
-
deviceId:string- Audio input device identifier.
-
Promise<void>- Promise that resolves tovoid.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.setAudioInputDevice('audioDeviceId')
.catch(error => console.log(`Error: ${error}`));
});Sets the video input device with the given id to be used during the call.
-
deviceId:string- Video input device identifier.
-
Promise<void>- Promise that resolves tovoid.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', ApplicationCallOptions.builder().setVideo(true).build());
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.setVideoInputDevice('videoDeviceId')
.catch(error => console.log(`Error: ${error}`));
});Sets the audio filter to be used during the 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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
let audioFilter = createAudioFilterImplementation();
applicationCall.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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
let audioFilter = createAudioFilterImplementation();
applicationCall.setAudioFilter(audioFilter);
applicationCall.clearAudioFilter();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 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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', ApplicationCallOptions.builder().setVideo(true).build());
let videoFilter = createVideoFilterImplementation();
applicationCall.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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', ApplicationCallOptions.builder().setVideo(true).build());
let videoFilter = createVideoFilterImplementation();
applicationCall.setVideoFilter(videoFilter);
applicationCall.clearVideoFilter();Gets an instance of LocalCapturer, which can be used to take screenshots of participants' 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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', ApplicationCallOptions.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
applicationCall.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.callApplication('45g2gql9ay4a2blu55uk1628', ApplicationCallOptions.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
call.
none
-
DataChannel- Returns an instance of a data channel.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', ApplicationCallOptions.builder().setDataChannel(true).build());
applicationCall.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 infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let videoOptions = VideoOptions.builder().setCameraOrientation(CameraOrientation.BACK).build();
let applicationCallOptions = ApplicationCallOptions.builder().setVideo(true).setVideoOptions(videoOptions).build();
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', applicationCallOptions);
console.log(`Camera orientation is: ${applicationCall.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 infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', ApplicationCallOptions.builder().setVideo(true).build());
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
console.log(`Audio quality mode: ${applicationCall.audioQualityMode()}`);Hangs up a call, which ends up in the party receiving
a CallsApiEvent.HANGUP event, after the hangup is processed by
Infobip's platform.
none
N/A
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.hangup();
});Getter for the recordingState field.
none
-
RecordingState- Value of therecordingStatefield that represents the recording state of the current call/dialog/conference and is updated each time the recording starts/stops.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
console.log(`Recording state: ${applicationCall.recordingState()}`);Configures the event handler for application call events.
-
eventName:CallsApiEvent- Name of the application call event. Allowed values are shown inCallsApiEvent. -
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:-
RINGING- No additional data is provided in the event object.event = {}
-
EARLY_MEDIA- AMediaStreamobject representing the media being played is received in the event object.event = { stream: MediaStream }
-
ESTABLISHED- AMediaStreamobject representing the media in the call is received in the event object.event = { stream: MediaStream }
-
HANGUP- A receivedErrorCodeobject provides details about the reason for the call hang-up, 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- AVideoRemovalReasonenum value giving additional info on the reason for removing the camera video.event = { reason: VideoRemovalReason }
-
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 }
-
CONFERENCE_JOINED- Data containing conference information is received in the event object. It contains conference id, name and array ofParticipantobjects representing the participants that are already in the conference.event = { id: string, name: string, participants: Participant[] }
-
CONFERENCE_LEFT- A receivedErrorCodeobject provides details about the reason for the participant leaving the conference.event = { errorCode: ErrorCode }
-
PARTICIPANT_JOINING- AParticipantobject representing the participant joining the conference.event = { participant: Participant }
-
PARTICIPANT_JOINED- AParticipantobject representing the participant that joined the conference.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 conference.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 }
-
DIALOG_JOINED- Dialog information is received in the event object. It contains dialog id and aParticipantobject representing the remote participant of the dialog.event = { id: string, remote: Participant }
-
DIALOG_LEFT- A receivedErrorCodeobject provides details about the reason for the participant leaving the dialog.event = { errorCode: ErrorCode }
-
RECONNECTING- No additional data is provided in the event object.event = {}
-
RECONNECTED- AMediaStreamobject representing the media in the call is received in the event object.event = { stream: MediaStream }
-
NETWORK_QUALITY_CHANGED- An event containing a NetworkQuality and a CurrentMediaStats objects 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 provides details on the network quality specifically for a given participant.event = { participant: Participant, networkQuality: NetworkQuality }
-
CALL_RECORDING_STARTED- An event that is triggered once a call recording starts. It includes RecordingType enum value which corresponds to the type of recording initiated.event = { recordingType: RecordingType }
-
CALL_RECORDING_STOPPED- An event that is triggered once a call recording stops.event = { }
-
CONFERENCE_RECORDING_STARTED- An event that is triggered once a conference recording starts. It includes RecordingType enum value which corresponds to the type of recording initiated.event = { recordingType: RecordingType }
-
CONFERENCE_RECORDING_STOPPED- An event that is triggered once a conference recording stops.event = { }
-
DIALOG_RECORDING_STARTED- An event that is triggered once a dialog recording starts. It includes RecordingType enum value which corresponds to the type of recording initiated.event = { recordingType: RecordingType }
-
DIALOG_RECORDING_STOPPED- An event that is triggered once a dialog recording stops.event = { }
-
RECONNECTING- No additional data is provided in the event object.event = {}
-
RECONNECTED- No additional data is provided in the event object.event = {}
-
ROLE_CHANGED- ARoleobject representing the new role of the local participant.event = { role: Role }
-
PARTICIPANT_ROLE_CHANGED- AParticipantobject representing the participant whose role has changed.event = { participant: Participant }
-
MESSAGE_RECEIVD- A message sent to a WebRTC endpoint using the Calls API.event = { message: string }
-
N/A
Let's assume you have an audio HTML element with the id callAudio and video HTML elements with the ids localVideo
and remoteVideo.
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', ApplicationCallOptions.builder()
.setAutoReconnect(true) // Required in order to receive RECONNECTING and RECONNECTED events
.build());
applicationCall.on(CallsApiEvent.RINGING, () => {
console.log('Ringing...');
});
applicationCall.on(CallsApiEvent.EARLY_MEDIA, (event) => {
console.log('Ringtone playing...');
$('#callAudio').srcObject = event.stream;
});
applicationCall.on(CallsApiEvent.ESTABLISHED, (event) => {
$('#callAudio').srcObject = event.stream;
});
applicationCall.on(CallsApiEvent.CAMERA_VIDEO_ADDED, (event) => {
$('#localVideo').srcObject = event.stream;
});
applicationCall.on(CallsApiEvent.PARTICIPANT_CAMERA_VIDEO_ADDED, (event) => {
console.log(`Participant: ${event.participant.endpoint.identifier} turned on their camera`);
$('#remoteVideo').srcObject = event.stream;
});
applicationCall.on(CallsApiEvent.PARTICIPANT_MUTED, (event) => {
console.log(`Participant: ${event.participant.endpoint.identifier} is muted`);
});
applicationCall.on(CallsApiEvent.PARTICIPANT_UNMUTED, (event) => _ => {
console.log(`Participant: ${event.participant.endpoint.identifier} is unmuted`);
});
applicationCall.on(CallsApiEvent.TALKING_WHILE_MUTED, (event) => {
console.log('You are talking while muted. Do you want to unmute?');
});
applicationCall.on(CallsApiEvent.STARTED_TALKING, (event) => {
console.log('You started talking!');
});
applicationCall.on(CallsApiEvent.STOPPED_TALKING, (event) => {
console.log('You stopped talking!');
});
applicationCall.on(CallsApiEvent.HANGUP, (event) => {
console.log(`Call finished. Status: ${event.errorCode.name}`);
});
applicationCall.on(CallsApiEvent.ERROR, (event) => {
console.log(`An error has occurred. Error: ${event.errorCode.name}`);
});
applicationCall.on(CallsApiEvent.RECONNECTING, function (event) {
console.log('Call is being reconnected, hang tight!');
})
applicationCall.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!`);
});
applicationCall.on(CallsApiEvent.NETWORK_QUALITY_CHANGED, (event) => {
console.log(`Local network quality is: ${NetworkQuality[event.networkQuality]}`);
});
applicationCall.on(CallsApiEvent.PARTICIPANT_NETWORK_QUALITY_CHANGED, (event) => {
console.log(`Network quality of ${event.participant.endpoint.identifier} is: ${NetworkQuality[event.networkQuality]}`);
});
applicationCall.on(CallsApiEvent.CALL_RECORDING_STARTED, (event) => {
console.log(`Call recording started with type ${event.recordingType}`);
});
applicationCall.on(CallsApiEvent.CALL_RECORDING_STOPPED, (event) => {
console.log(`Call recording stopped`);
});
applicationCall.on(CallsApiEvent.CONFERENCE_RECORDING_STARTED, (event) => {
console.log(`Conference recording started with type ${event.recordingType}`);
});
applicationCall.on(CallsApiEvent.CONFERENCE_RECORDING_STOPPED, (event) => {
console.log(`Conference recording stopped`);
});
applicationCall.on(CallsApiEvent.DIALOG_RECORDING_STARTED, (event) => {
console.log(`Dialog recording started with type ${event.recordingType}`);
});
applicationCall.on(CallsApiEvent.DIALOG_RECORDING_STOPPED, (event) => {
console.log(`Dialog recording stopped`);
});
applicationCall.on(CallsApiEvent.DISCONNECTED, (event) => {
console.log('Call disconnected!');
});
applicationCall.on(CallsApiEvent.RECONNECTED, (event) => {
console.log('Call reconnected!');
});
applicationCall.on(CallsApiEvent.ROLE_CHANGED, (event) => {
console.log(`Local participant's role has changed to ${event.role.type}!`);
});
applicationCall.on(CallsApiEvent.PARTICIPANT_ROLE_CHANGED, (event) => {
console.log(`Role of participant: ${event.participant.endpoint.identifier} has changed to ${event.participant.role?.type}!`);
});
applicationCall.on(CallsApiEvent.MESSAGE_RECEIVED, (event) => {
console.log(`Message received: ${event.message}`);
});