-
Notifications
You must be signed in to change notification settings - Fork 0
ApplicationCall
id(): String
options(): ApplicationCallOptions
customData(): CustomData
status(): CallStatus
duration(): number
startTime(): Date
establishTime(): Date
endTime(): Date
callsConfigurationId(): String
mute(shouldMute: boolean): Promise<void>
muted(): boolean
sendDTMF(dtmf: String): Promise<void>
pauseIncomingVideo(): void;
resumeIncomingVideo(): void;
cameraVideo(cameraVideo: boolean): Promise<void>
hasCameraVideo(): boolean
screenShare(screenShare: boolean): Promise<void>
startScreenShare(displayOptions?: DisplayOptions): Promise<void>
stopScreenShare(): Promise<void>
hasScreenShare(): boolean
setAudioInputDevice(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(): LocalCapturer
serverCapturer(): ServerCapturer
dataChannel(): DataChannel
cameraOrientation(): CameraOrientation
setCameraOrientation(cameraOrientation: CameraOrientation): Promise<void>
audioQualityMode(audioQualityMode: AudioQualityMode): void
setReconnectHandler(reconnectHandler: ReconnectHandler): void
hangup(): void
recordingState(): RecordingState
on(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 thecustomData
field that is defined as an object of key-valuestring
pairs.
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 ID
which 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
-true
if 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:
0
to9
- letters:
A
toD
- 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();
}
});
});
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();
}
});
});
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
-true
if 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
startScreenShare
andstopScreenShare
methods.
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
-true
if 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 theAudioFilter
interface.
-
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 theVideoFilter
interface.
-
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 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 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 applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628', ApplicationCallOptions.builder().setVideo(true).build());
applicationCall.on(CallsApiEvent.ESTABLISHED, _ => {
applicationCall.audioQualityMode(AudioQualityMode.LOW_DATA)
});
Setter for the ReconnectHandler
. This callback is required in order to enable reconnect
functionality on the application call level (receive RECONNECTING
and
RECONNECTED
events).
-
reconnectHandler
- A function used to set theApplicationCallOptions
of the new (reconnected) call.
N/A
let infobipRTC = createInfobipRtc('2e29c3a0-730a-4526-93ce-cda44556dab5', {debug: true});
let applicationCall = infobipRTC.callApplication('45g2gql9ay4a2blu55uk1628');
applicationCall.setReconnectHandler((reconnectingCallId, reconnectingCallOptions) => {
// Add any custom data that will help you handle the reconnect flow on your backend application
reconnectingCallOptions.customData["reconnectingCallId"] = reconnectingCallId;
// optionally turn off video
reconnectingCallOptions.video = false
return reconnectingCallOptions
})
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 therecordingState
field 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
- AMediaStream
object representing the media being played is received in the event object.event = { stream: MediaStream }
-
ESTABLISHED
- AMediaStream
object representing the media in the call is received in the event object.event = { stream: MediaStream }
-
HANGUP
- A receivedErrorCode
object provides details about the reason for the call hang-up, along with aTotalMediaStats
object that offers a comprehensive summary of the call's audio statistics.event = { errorCode: ErrorCode, totalMediaStats: TotalMediaStats }
-
ERROR
- A receivedErrorCode
object provides details about the reason for the error occurrence.event = { errorCode: ErrorCode }
-
CAMERA_VIDEO_ADDED
- AMediaStream
object representing the media in the call is received in the event object.event = { stream: MediaStream }
-
CAMERA_VIDEO_UPDATED
- AMediaStream
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
- AMediaStream
object representing the media in the call is received in the event object.event = { stream: MediaStream }
-
SCREEN_SHARE_REMOVED
- AVideoRemovalReason
enum 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 ofParticipant
objects representing the participants that are already in the conference.event = { id: string, name: string, participants: Participant[] }
-
CONFERENCE_LEFT
- A receivedErrorCode
object provides details about the reason for the participant leaving the conference.event = { errorCode: ErrorCode }
-
PARTICIPANT_JOINING
- AParticipant
object representing the participant joining the conference.event = { participant: Participant }
-
PARTICIPANT_JOINED
- AParticipant
object representing the participant that joined the conference.event = { participant: Participant }
-
PARTICIPANT_MUTED
- AParticipant
object representing the participant that was muted.event = { participant: Participant }
-
PARTICIPANT_UNMUTED
- AParticipant
object representing the participant that was unmuted.event = { participant: Participant }
-
PARTICIPANT_DEAF
- AParticipant
object representing the participant that was deafened.event = { participant: Participant }
-
PARTICIPANT_UNDEAF
- AParticipant
object representing the participant that was undeafened.event = { participant: Participant }
-
PARTICIPANT_STARTED_TALKING
- AParticipant
object representing the participant that started talking.event = { participant: Participant }
-
PARTICIPANT_STOPPED_TALKING
- AParticipant
object representing the participant that stopped talking.event = { participant: Participant }
-
PARTICIPANT_LEFT
- AParticipant
object representing the participant that left the conference.event = { participant: Participant }
-
PARTICIPANT_CAMERA_VIDEO_ADDED
- AParticipant
andMediaStream
object representing the participant and their camera video stream.event = { participant: Participant, stream: MediaStream }
-
PARTICIPANT_CAMERA_VIDEO_REMOVED
- AParticipant
object representing the participant that removed their camera video.event = { participant: Participant }
-
PARTICIPANT_SCREEN_SHARE_ADDED
- AParticipant
andMediaStream
object representing the participant and their screen share stream.event = { participant: Participant, stream: MediaStream }
-
PARTICIPANT_SCREEN_SHARE_REMOVED
- AParticipant
object 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 aParticipant
object representing the remote participant of the dialog.event = { id: string, remote: Participant }
-
DIALOG_LEFT
- A receivedErrorCode
object 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
- AMediaStream
object 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 object which details 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 object which details 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 object which details the type of recording initiated.event = { recordingType: RecordingType }
-
DIALOG_RECORDING_STOPPED
- An event that is triggered once a dialog recording stops.event = { }
-
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');
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.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}`);
});
// make sure to set reconnect handler callback. This is required in order
// to receive RECONNECTING and RECONNECTED events.
applicationCall.on(CallsApiEvent.RECONNECTING, function (event) {
console.log('Call is being reconnected, hang tight!');
})
applicationCall.on(CallsApiEvent.RECONNECTED, function (event) {
$('#remoteAudio').srcObject = event.stream;
console.log(`You have successfully reconnected the call!`);
});
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`);
});