Skip to main content

Functions

Use the following API functions to control your embedded Jitsi Meet Conference.

captureCameraPicture​

Mobile browsers only. Captures a high quality picture using the device's camera. All parameters are optional.

api.captureCameraPicture(
cameraFacingMode, // the facing mode: environment/user. Defaults to environment.
descriptionText, // a custom description text to replace the default text on the consent dialog.
titleText // a custom title to replace the default title on the consent dialog.
).then(data => {
// data is an Object with only one param, either dataURL on success or error on failure.
// - dataURL is the base64 string of the taken picture
// - error is a string, a verbose explanation of the problem
// data.dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABQAA..."
});

captureLargeVideoScreenshot​

Captures a screenshot for the participant in the large video view (on stage).

api.captureLargeVideoScreenshot().then(data => {
// data is an Object with only one param, dataURL
// data.dataURL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABQAA..."
});

getAvailableDevices​

Retrieves a list of available devices.

api.getAvailableDevices().then(devices => {
// devices = {
// audioInput: [{
// deviceId: 'ID'
// groupId: 'grpID'
// kind: 'audioinput'
// label: 'label'
// },....],
// audioOutput: [{
// deviceId: 'ID'
// groupId: 'grpID'
// kind: 'audioOutput'
// label: 'label'
// },....],
// videoInput: [{
// deviceId: 'ID'
// groupId: 'grpID'
// kind: 'videoInput'
// label: 'label'
// },....]
// }
...
});

getConnectionStats​

Returns a promise which resolves with the local connection stats (bitrate, packet loss, connection quality, etc). The codec, framerate, framesDecoded and resolution fields are keyed by participant ID, then by SSRC.

api.getConnectionStats().then(stats => {
// stats = {
// connectionQuality: 95.4,
// jvbRTT: 1,
// bridgeCount: 1,
// serverRegion: null,
// bandwidth: {
// download: null,
// upload: 2216
// },
// bitrate: {
// download: 0,
// upload: 954,
// audio: { download: 0, upload: 7 },
// video: { download: 0, upload: 947 }
// },
// packetLoss: {
// download: 0,
// total: 0,
// upload: 0
// },
// maxEnabledResolution: 720,
// codec: { ... },
// framerate: { ... },
// framesDecoded: { ... },
// resolution: { ... },
// transport: [
// { ip: '...', localCandidateType: 'host', p2p: false, rtt: 1, type: 'udp', ... }
// ],
// iceConnected: true
// }
...
});

getContentSharingParticipants​

Returns a promise which resolves with an array of currently sharing participants ID's.

api.getContentSharingParticipants().then(res => {
//res.sharingParticipantIds = [particId1, particId2, ...]
});

getCurrentDevices​

Retrieves a list of currently selected devices.

api.getCurrentDevices().then(devices => {
// devices = {
// audioInput: {
// deviceId: 'ID'
// groupId: 'grpID'
// kind: 'videoInput'
// label: 'label'
// },
// audioOutput: {
// deviceId: 'ID'
// groupId: 'grpID'
// kind: 'videoInput'
// label: 'label'
// },
// videoInput: {
// deviceId: 'ID'
// groupId: 'grpID'
// kind: 'videoInput'
// label: 'label'
// }
// }
...
});

getDeploymentInfo​

Retrieves an object containing information about the deployment.

api.getDeploymentInfo().then(deploymentInfo => {
// deploymentInfo = {
// region: 'deployment-region',
// shard: 'deployment-shard',
// ...
// }
...
});

getLivestreamUrl​

Retrieves an object containing information about livestreamUrl of the current live stream.

api.getLivestreamUrl().then(livestreamData => {
// livestreamData = {
// livestreamUrl: 'livestreamUrl'
// }
...
});

getParticipantsInfo​

DEPRECATED Use getRoomsInfo instead.

Returns an array containing participant information such as ID, display name, avatar URL, and email.

api.getParticipantsInfo();

getRoomsInfo​

Returns an array of available rooms and details of it:

  • isMainRoom (true,false), id, jid
  • participants: Participant[]
    • id
    • jid
    • role
    • displayName
    • userContext
    • isJigasi
    • isHidden
    • audioMuted
    • videoMuted
/**
* @param {boolean} includeHidden - Whether to include hidden participants (e.g. Jibri, transcriber) in the response. Defaults to false.
*/
api.getRoomsInfo(includeHidden).then(rooms => {
... // see response example structure
})

Response example structure:

{
"rooms": [
{
"isMainRoom": true,
"id": "room_name@conference.jitsi",
"jid": "room_name@conference.jitsi/aaaaaa",
"participants": [
{
"jid": "room_name@conference.jitsi/bbbbbb",
"role": "participant",
"displayName": "p1",
"id": "bbbbbb",
"userContext": {
"id": "google-oauth2|12345678901234567890"
},
"isJigasi": false,
"isHidden": true,
"audioMuted": true,
"videoMuted": true
},
{
"jid": "room_name@conference.jitsi/cccccc",
"role": "participant",
"displayName": "p2",
"id": "cccccc",
"userContext": {
"id": "400e45d607256777df4e0f3a6a447901"
},
"isJigasi": true,
"isHidden": false,
"audioMuted": false,
"videoMuted": false
}
]
},
{
"isMainRoom": false,
"id": "aaaaaa-bbb-cccc-dddd-qwertyuiopas",
"jid": "aaaaaa-bbb-cccc-dddd-qwertyuiopas@breakout.jitsi",
"participants": [{
"jid": "aaaaaa-cccc-dddd-eeee-qwertyuiopas@jitsi/abcd1234",
"role": "moderator",
"displayName": "Participant name",
"avatarUrl": "",
"id": "abcd1234",
"userContext": {
"id": "73317803a589aaa027132696dd77ac34"
}
}]
},
]
}

getSessionId​

Returns the meting's unique Id (sessionId). Please note that the sessionId is not available when in prejoin screen and it's not guaranteed to be available immediately after joining - in which cases it will be empty.

api.getSessionId().then(sessionId => {
//sessionId: string
...
});

getSharedDocumentUrl​

Returns the meeting's unique etherpad shared document url (sharedDocumentUrl). Please note that the sharedDocumentUrl is not available when in prejoin screen and it's not guaranteed to be available immediately after joining - in which cases it will be empty.

api.getSharedDocumentUrl().then(sharedDocumentUrl => {
//sharedDocumentUrl: string
...
});

getVideoQuality​

Returns the current video quality setting.

api.getVideoQuality();

getSupportedCommands​

Returns array of commands supported by api.executeCommand(command, ...arguments);

api.getSupportedCommands();

getSupportedEvents​

Returns array of events supported by api.addListener(event, listener);

api.getSupportedEvents();

isDeviceChangeAvailable​

Resolves to true if the device change is available and to false if not.

// The accepted deviceType values are - 'output', 'input' or undefined.
api.isDeviceChangeAvailable(deviceType).then(isDeviceChangeAvailable => {
...
});

isDeviceListAvailable​

Resolves to true if the device list is available and to false if not.

api.isDeviceListAvailable().then(isDeviceListAvailable => {
...
});

isMultipleAudioInputSupported​

Resolves to true if multiple audio input is supported and to false if not.

api.isMultipleAudioInputSupported().then(isMultipleAudioInputSupported => {
...
});

pinParticipant​

Selects the participant ID to be the pinned participant in order to always receive video for this participant.

The second parameter is optional and can be used to specify a videoType. When multistream support is enabled by passing this parameter you can specify whether the desktop or the camera video for the specified participant should be pinned. The accepted values are 'camera' and 'desktop'. The default is 'camera'. Any invalid values will be ignored and default will be used.

api.pinParticipant(participantId, videoType);

resizeLargeVideo​

Resizes the large video container per the provided dimensions.

api.resizeLargeVideo(width, height);

setAudioInputDevice​

Sets the audio input device to the one with the passed label or ID.

api.setAudioInputDevice(deviceLabel, deviceId);

setAudioOutputDevice​

Sets the audio output device to the one with the passed label or ID.

api.setAudioOutputDevice(deviceLabel, deviceId);

setLargeVideoParticipant​

Displays the participant with the given participant ID on the large video.

If no participant ID is given, a participant is picked based on the dominant, pinned speaker settings.

api.setLargeVideoParticipant(participantId);

setVideoInputDevice​

Sets the video input device to the one with the passed label or ID.

api.setVideoInputDevice(deviceLabel, deviceId);

setVirtualBackground​

Set your virtual background with a base64 image.

/**
* @param {boolean} enabled - Enable or disable the virtual background.
* @param {string} backgroundImage - Base64 image string, eg. "data:image/png;base64, iVBOR...".
*/
api.setVirtualBackground(enabled, backgroundImage);

startRecording​

Starts a file recording or streaming session. See the startRecording command for more details.

api.startRecording(options);

stopRecording​

Stops an ongoing file recording, streaming session or transcription. See the stopRecording command for more details.

api.stopRecording(mode, transcription);

getNumberOfParticipants​

Returns the number of conference participants:

const numberOfParticipants = api.getNumberOfParticipants();

getAvatarURL​

DEPRECATED Use getRoomsInfo instead.

Returns a participant's avatar URL:

const avatarURL = api.getAvatarURL(participantId);

getDisplayName​

Returns a participant's display name:

const displayName = api.getDisplayName(participantId);

getEmail​

Returns a participant's email:

const email = api.getEmail(participantId);

getIFrame​

Returns the IFrame HTML element which is used to load the Jitsi Meet conference:

const iframe = api.getIFrame();

isAudioDisabled​

Returns a Promise which resolves to the current audio disabled state:

api.isAudioDisabled().then(disabled => {
...
});

isAudioMuted​

Returns a Promise which resolves to the current audio muted state:

api.isAudioMuted().then(muted => {
...
});

isVideoMuted​

Returns a Promise which resolves to the current video muted state:

api.isVideoMuted().then(muted => {
...
});

isAudioAvailable​

Returns a Promise which resolves to the current audio availability state:

api.isAudioAvailable().then(available => {
...
});

isVideoAvailable​

Returns a Promise which resolves to the current video availability state:

api.isVideoAvailable().then(available => {
...
});

isVisitor​

Returns a whether the current user is a visitor or not.

const isVisitor = api.isVisitor();

isModerationOn​

Returns a Promise which resolves to the current moderation state of the given media type.

mediaType can be either audio (default) or video.

api.isModerationOn(mediaType).then(isModerationOn => {
...
});

isP2pActive​

Returns a Promise which resolves to a Boolean or null, when there is no conference.

api.isP2pActive().then(isP2p => {
...
});

isParticipantForceMuted​

Returns a Promise which resolves to the current force mute state of the given participant for the given media type.

mediaType can be either audio (default) or video.

Force muted - moderation is on and participant is not allowed to unmute the given media type.

api.isParticipantForceMuted(participantId, mediaType).then(isForceMuted => {
...
});

isParticipantsPaneOpen​

Returns a Promise which resolves with the current participants pane state.

api.isParticipantsPaneOpen().then(state => {
...
});

isStartSilent​

Returns a Promise which resolves with whether meeting was started in view only.

api.isStartSilent().then(startSilent => {
...
});

listBreakoutRooms​

Returns a Promise which resolves with the map of breakout rooms.

api.listBreakoutRooms().then(breakoutRooms => {
...
});

invite​

Invite the given array of participants to the meeting:

api.invite([ {...}, {...}, {...} ]).then(() => {
// success
}).catch(() => {
// failure
});

NOTE: The invitee format in the array depends on the invite service used in the deployment.

PSTN invite objects have the following structure:

{
type: 'phone',
number: <string> // the phone number in E.164 format (ex. +31201234567)
}

SIP invite objects have the following structure:

{
type: 'sip',
address: <string> // the sip address
}

dispose​

Removes the embedded Jitsi Meet conference:

api.dispose();

NOTE: Jitsi recommends removing the conference before the page is unloaded.