# new Client(options)
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
Object
|
the options object |
|
roomToken |
string
|
generated from the server by calling the /room-token endpoint (required) (see server documentation) |
|
options |
Object
|
<optional> |
additional options |
options.enableBandwidthMonitoring |
boolean
|
<optional> |
whether to enable bandwidth monitoring (default is false) |
- ClientEvents.event:USER_JOINED_ROOM - emitted when a user joins the room
- ClientEvents.ROOM_CLOSED - emitted when the room closes,event: either by the user or the room owner
- ClientEvents.event:USER_DISCONNECTED - emitted when a user disconnects from the room
- ClientEvents.event:AUDIO_MUTED - emitted when the local audio is muted or unmuted
- ClientEvents.event:VIDEO_MUTED - emitted when the local video is muted or unmuted
- ClientEvents.event:REMOTE_AUDIO_MUTED - emitted when a remote user's audio is muted or unmuted
- ClientEvents.event:REMOTE_VIDEO_MUTED - emitted when a remote user's video is muted or unmuted
- ClientEvents.event:OUTPUT_MUTED - emitted when the local audio output is muted or unmuted
- ClientEvents.event:REMOTE_OUTPUT_MUTED - emitted when a remote user's audio output is muted or unmuted
- ClientEvents.event:DATA_MESSAGE - emitted when a data message is received
- ClientEvents.event:RECORDING_STARTED - emitted when recording starts
- ClientEvents.event:RECORDING_STOPPED - emitted when recording stops
- ClientEvents.RECORDING_STATE_CHANGED - emitted when the recording state changes (started or stopped)
- ClientEvents.event:RECEIVE_CHAT_MESSAGE - emitted when a chat message is received
- ClientEvents.event:STREAMING_STARTED - emitted when streaming starts
- ClientEvents.event:STREAMING_STOPPED - emitted when streaming stops
- ClientEvents.event:STREAMING_USER_CHANGED - emitted when the streaming user changes
- ClientEvents.event:ADMIT_WAITING_ROOM - emitted when a user is admitted from the waiting room
- ClientEvents.event:REJECT_WAITING_ROOM - emitted when a user is rejected from the waiting room
- ClientEvents.event:TRANSCRIPTION_RECEIVED - emitted when a transcription is received
- ClientEvents.event:TRANSCRIPTION_STARTED - emitted when transcription starts
- ClientEvents.event:TRANSCRIPTION_STOPPED - emitted when transcription stops
Example
// In your server side application
app.post('/generate-room-token', async function (req, res) {
const apiKey = process.env.APIKEY // this is your-api-key obtain from Hiyve. Pass in ENV or read from a db etc
try {
const response = await fetch('https://rtc.muziemedia.com/room-token', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
apiKey: <your-apikey>, // keep these server side
secret: <your-client-secret> // keep these server side
}),
});
const data = await response.json();
res.send(data); // return the generated roomToken back to your client application
} catch (error) {
console.error('Error:', error);
res.status(500).send({ error: 'An error occurred while generating the room token' });
}
});
// In your client side application
// in index.html (or similar)
<head>
<script src="https://s3.amazonaws.com/muzie.media/dist_latest/muziertcclient.js"></script>
</head>
// in app.jsx (or similar)
const { Client } = window.MuzieClient;
const client = new Client({
roomToken: 'your-room-token' (generated by your server app calling the /room-token endpoint)
});
// add event listeners
client.addEventListener(ClientEvents.MEDIA_TRACK_ADDED, (event) => {
console.log('Remote users media track added:', event.detail);
const { userId, track, kind } = event.detail;
// use the userId, track and kind to bind the track to a video & audio element
});
// get, list and select a device from devices if needed
const videoDevices = await client.listVideoDevices();
const audioInputDevices = await client.listAudioInputDevices();
const audioOutputDevices = await client.listAudioOutputDevices();
...
// set the devices (if needed)
await client.setLocalVideoDevice({ videoDeviceId: videoDevices[0].deviceId });
await client.setLocalAudioInputDevice({ audioInputDeviceId: audioInputDevices[0].deviceId });
await client.setAudioOutputDevice({ audioOutputDeviceId: audioOutputDevices[0].deviceId });
// create or join a room
const room = await client.createRoom({ roomName: 'my-room', userId: 'my-user');
// connect the transports
await client.connectTransports({ localVideoElementId: 'local-video' });
// mute or unmute the local audio (if needed)
await client.muteLocalAudio(true);
...
// close the connection when done
await client.closeConnection();
Members
# isReady
Check if client is ready synchronously.
Use this for UI state checks, but prefer await client.ready() for operations.
Example
if (client.isReady) {
// Safe to perform operations
await client.createRoom({ roomName: 'my-room', userId: 'my-user' });
}
Methods
# async admitWaitingRoomUser(options) → {Promise.<void>}
Admit a user from the waiting room
This can only be called by the room owner and if the room is in waiting room mode
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
userToAdmit |
string
|
the id of the user to admit |
Resolves when the user is admitted
Promise.<void>
Example
// Handle waiting room admit event
client.addEventListener(ClientEvents.ADMIT_WAITING_ROOM, async (e) => {
const { userId, userName } = e.detail;
if (confirm(`Admit ${userName}?`)) {
await client.admitWaitingRoomUser({ userToAdmit: userId });
}
});
# async applyAudioOutputToElement(element) → {Promise.<boolean>}
Apply the current audio output device to a specific HTML media element
This is useful when creating new audio/video elements after receiving MEDIA_TRACK_ADDED. Call this method after attaching the track to the element to ensure audio plays through the selected output device.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
HTMLMediaElement
|
The audio or video element to apply the output device to |
True if successful, false if setSinkId not supported or no device set
Promise.<boolean>
Example
client.addEventListener('media-track-added', async (event) => {
const { userId, track, kind } = event.detail;
if (kind === 'audio' || kind === 'video') {
const element = document.getElementById(`remote-video-${userId}`);
element.srcObject = new MediaStream([track]);
await client.applyAudioOutputToElement(element);
}
});
# checkAudioDevice() → {boolean}
Check if this browser supports audio output
True if audio output is supported
boolean
Example
if (!client.checkAudioDevice()) {
console.warn('Audio not supported on this device');
}
# checkVideoDevice() → {boolean}
Check if this browser supports video output
True if video output is supported
boolean
Example
if (!client.checkVideoDevice()) {
console.warn('Video not supported on this device');
}
# async closeConnection() → {Promise.<void>}
Close the connection and room. Should always be called when the user wants to leave the room. This also closes the audio context and audio input monitor.
Resolves when the connection is fully closed
Promise.<void>
Example
document.getElementById('leave-btn').onclick = async () => {
await client.closeConnection();
console.log('Left the room');
window.location.href = '/';
};
# async closeNoVideoRoom() → {Promise.<void>}
Close the audio-only room connection. Only use this if you are using the no video room methods.
Promise.<void>
Example
await client.closeNoVideoRoom();
console.log('Audio-only room closed');
# async connectTransports(params) → {Promise.<void>}
Connect the media devices to the room. This method should be called after the room is created or joined.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
params |
Object
|
The parameters object |
||
localVideoElementId |
string
|
The id of the video element to attach local video to |
||
options |
ConnectTransportsOptions
|
<optional> |
Additional options for audio processing |
|
waitingRoomToken |
string
|
<optional> |
Token for waiting room (from WAITING_LIST_ADMIT event) |
|
audioOnly |
boolean
|
<optional> |
false | Join in audio-only mode (no video broadcast) |
videoOnly |
boolean
|
<optional> |
false | Join in video-only mode (no microphone access or audio broadcast) |
If transport creation fails, or if both audioOnly and videoOnly are true
Error
Resolves when media devices are connected
Promise.<void>
Examples
// Standard connection with video
await client.connectTransports({
localVideoElementId: 'local-video',
options: { enableGainControl: true }
});
// Audio-only mode (no camera)
await client.connectTransports({
localVideoElementId: 'local-video',
audioOnly: true
});
// Video-only mode (no microphone — e.g. phone used as extra camera)
await client.connectTransports({
localVideoElementId: 'local-video',
videoOnly: true
});
# async copyPublicFileToPrivate(params) → {Promise.<object>}
Server-side copy-on-write a public file into the caller's private library.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
params |
object
|
||
userId |
string
|
||
fileId |
string
|
Source public file ID. |
|
location |
string
|
<optional> |
Destination folder (default '/'). |
roomName |
string
|
<optional> |
Destination room binding. |
New private FileIndex document.
Promise.<object>
# async createFolder(options) → {Promise.<FileMetadata>}
Create a folder in the user's storage
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
location |
string
|
Path where the folder should be created (e.g., "/documents/project1") |
If room is not created or location is missing
Error
A Promise that resolves to the created folder metadata
Promise.<FileMetadata>
Example
const folder = await fileManager.createFolder({
location: "/presentations/quarterly"
});
console.log(`Created folder with ID: ${folder.fileId}`);
# async createJoinToken(options) → {Promise.<Object>}
Create a token that can be used to join a room. Only the room owner can create these.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options |
Object
|
The options object |
||
userId |
string
|
The room owner's user ID |
||
roomName |
string
|
The name of the room |
||
joinUserId |
string
|
<optional> |
The ID of the user that is joining (required for type 'individual') |
|
password |
string
|
<optional> |
Optional password for the token |
|
expiresIn |
number
|
<optional> |
Token validity in seconds |
|
type |
string
|
<optional> |
'group' | Token type: 'individual' or 'group' |
Object containing joinToken and roomRegion for URL parameters
Promise.<Object>
Example
// Create a group join token (anyone with this token can join)
const { joinToken, roomRegion } = await client.createJoinToken({
userId: 'host123',
roomName: 'team-meeting',
expiresIn: 3600, // 1 hour
type: 'group'
});
const inviteUrl = `https://app.com/join?token=${joinToken}®ion=${roomRegion}`;
# async createNoVideoRoom(options) → {Promise.<Room>}
Create a new audio-only room with no video
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
roomName |
string
|
The name of the room to create |
userId |
string
|
The user ID of the room creator |
If room creation fails
Error
The created room object
Promise.<Room>
Example
const room = await client.createNoVideoRoom({
roomName: 'audio-conference',
userId: 'host123'
});
console.log('Audio-only room created:', room.name);
# async createRoom(options) → {Promise.<Room>}
Create a new room
This can only be called once per room and the user that creates the room is the owner The owner can mute and unmute other users, but other users cannot mute the owner When the owner closes the room, all other users are disconnected If the owner refreshes the page, they will need to rejoin the room using create again so they stay as the owner. A refresh does not close the room for other users
Note that roomNames and userIds are cleaned both here and on the server to remove non aphanumberic characters apart from _ and lowercased, all - are converted to _
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options |
Object
|
The options object. |
||
roomName |
string
|
the name of the room |
||
userId |
string
|
the id of the user |
||
externalUserId |
string
|
<optional> |
an optional application specific user id (this is recommended and ensure its unique) |
|
options |
CreateRoomOptions
|
<optional> |
additional options |
|
options.inactivityTimeout |
number
|
<optional> |
60 | the time in seconds to wait before closing the room if the owner is no longer present |
options.timeoutOnEmptyRoomOnly |
boolean
|
<optional> |
false | whether to only timeout if the room is empty (the room will timeout regardless of users) |
options.requireWaitingRoom |
boolean
|
<optional> |
false | whether to require a waiting room (users must wait for access permission) |
a Promise that resolves when the room is created and returns a Room object
Promise.<Room>
Example
const room = await client.createRoom({
roomName: 'team-standup',
userId: 'host123',
externalUserId: 'app-user-abc',
options: {
inactivityTimeout: 120,
requireWaitingRoom: true
}
});
console.log('Room created:', room.name);
# async deleteFile(options) → {Promise.<boolean>}
Delete a file from the user's storage
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
fileId |
string
|
ID of the file to delete |
If room is not created or fileId is missing
Error
A Promise that resolves to true if deletion was successful
Promise.<boolean>
Example
await fileManager.deleteFile({
fileId: "abc123"
});
# async deleteFolder(options) → {Promise.<boolean>}
Delete a folder and all its contents from the user's storage
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
location |
string
|
Path of the folder to delete (e.g., "/documents/project1") |
If room is not created or location is missing
Error
A Promise that resolves to true if deletion was successful
Promise.<boolean>
Example
await fileManager.deleteFolder({
location: "/old-documents"
});
# async getAllUsersFiles() → {Promise.<Array.<FileMetadata>>}
Retrieve all files accessible to the current user in the room (or all rooms if user is room owner)
If room is not created
Error
A Promise that resolves to an array of file metadata objects
Promise.<Array.<FileMetadata>>
Example
const allFiles = await fileManager.getAllUsersFiles();
console.log(`Found ${allFiles.length} files`);
# async getAllUsersFilesSinceLastSync(options) → {Promise.<Array.<FileMetadata>>}
Get all files that have changed since a given timestamp
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
lastSyncTime |
number
|
string
|
Unix timestamp or ISO date string of last sync |
If room is not created
Error
A Promise that resolves to an array of changed file metadata
Promise.<Array.<FileMetadata>>
Example
const changedFiles = await fileManager.getAllUsersFilesSinceLastSync({
lastSyncTime: Date.now() - 3600000 // Changes in the last hour
});
# async getAttendees() → {Promise.<Array>}
Get the room attendees
If room not created yet
Error
Array of attendee objects with userId and connection info
Promise.<Array>
Example
const attendees = await client.getAttendees();
console.log(`${attendees.length} participants in room`);
attendees.forEach(a => console.log('User:', a.userId));
# getAudioGainControl() → {GainProcessor|null}
Get the audio gain control. The gain control allows adjusting audio input levels and is created when enableAudioGainControl option is true during connectTransports.
The audio gain control, or null if not enabled
GainProcessor
|
null
Example
// Adjust microphone volume
const gainControl = client.getAudioGainControl();
if (gainControl) {
document.getElementById('volume-slider').oninput = (e) => {
gainControl.setGain(e.target.value / 100);
};
}
# getAudioInputMonitor() → {AudioInputProcessor|null}
Get the audio input monitor. The monitor provides audio level data for visualization and is created when enableAudioInputMonitor option is true during connectTransports.
The audio input monitor, or null if not enabled
AudioInputProcessor
|
null
Example
// Create audio level visualization
const monitor = client.getAudioInputMonitor();
if (monitor) {
monitor.on('level', (level) => {
volumeMeter.style.width = (level * 100) + '%';
});
}
# getAudioMode() → {string}
Get the current audio mode
Current audio mode
string
Example
const mode = client.getAudioMode();
console.log('Audio mode:', mode); // 'default', 'music', 'presentation', or 'custom'
# getAudioOutputDeviceId() → {string|null}
Get the local audio output device id
The local audio output device id, or null if not set
string
|
null
Example
const speakerId = client.getAudioOutputDeviceId();
console.log('Current speaker:', speakerId);
# getAudioValidation() → {Object|null}
Get current audio validation status
Audio validation results or null if no audio stream
Object
|
null
Example
const validation = client.getAudioValidation();
if (!validation.isValid) {
console.warn('Audio issues:', validation.issues);
console.info('Recommendations:', validation.recommendations);
}
# getBandwidthMonitor() → {BandwidthMonitor|null}
Get the bandwidth monitor if enabled. The bandwidth monitor tracks bitrate, resolution, and FPS for video consumers.
The bandwidth monitor, or null if not enabled
BandwidthMonitor
|
null
Example
// Monitor video quality in real-time
const monitor = client.getBandwidthMonitor();
if (monitor) {
monitor.on('stats', (stats) => {
console.log('Bitrate:', stats.bitrate, 'FPS:', stats.fps);
});
}
# async getChatHistory(options) → {Promise.<Object>}
Get the chat history from the room
note: chat history will be retrieved for the room name. That means that if the same room name is used for multiple sessions, the chat history will be the same, so make sure thats what you intend.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
cursor |
string
|
the cursor is the latest nextCursor value returned from this function, it allows you to get the next set of messages (100 messages are returned at a time) |
a Promise that resolves to the chat history messages: Array of messages nextCursor: the next cursor value to get the next set of messages
Promise.<Object>
Example
// Load chat history with pagination
let cursor = null;
const loadMessages = async () => {
const { messages, nextCursor } = await client.getChatHistory({ cursor });
messages.forEach(msg => console.log(msg.userId + ': ' + msg.message));
cursor = nextCursor;
};
# async getCompositionList(options) → {Promise.<Array>}
Get the composition list This will get the list of compositions for the room
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
roomName |
string
|
the name of the room |
userId |
string
|
the id of the user |
a Promise that resolves to the list of compositions
Promise.<Array>
Example
// List all compositions for a room
const compositions = await client.getCompositionList({
roomName: 'my-room',
userId: 'user456'
});
compositions.forEach(c => console.log('Composition:', c.recordingId));
# async getCompositionStatus(options) → {Promise.<String>}
Get the status of a composition This will get the status of a composition
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
recordingId |
string
|
the id of the recording |
roomName |
string
|
the name of the room |
userId |
string
|
the id of the user |
a Promise that resolves to the composition status
Promise.<String>
Example
// Poll composition status until complete
const checkStatus = async () => {
const status = await client.getCompositionStatus({
recordingId: 'rec123',
roomName: 'my-room',
userId: 'user456'
});
console.log('Composition status:', status);
};
# async getCompositionUrl(options) → {Promise.<String>}
Get the composition url This will get the composition url
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
recordingId |
string
|
the id of the recording to get the composition url for |
roomName |
string
|
the name of the room |
userId |
string
|
the id of the user |
a Promise that resolves to the composition url
Promise.<String>
Example
// Get the composed video URL for playback
const url = await client.getCompositionUrl({
recordingId: 'rec123',
roomName: 'my-room',
userId: 'user456'
});
videoPlayer.src = url;
# async getFileMetadata(options) → {Promise.<FileMetadata>}
Get metadata for a specific file
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
fileId |
string
|
ID of the file to get metadata for |
If room is not created or fileId is missing
Error
A Promise that resolves to the file metadata
Promise.<FileMetadata>
Example
const metadata = await fileManager.getFileMetadata({
fileId: "abc123"
});
console.log(`File name: ${metadata.fileName}`);
# async getFileURL(options) → {Promise.<string>}
Get a presigned URL for a file.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options |
Object
|
The options object |
||
fileId |
string
|
ID of the file to get the URL for |
||
stream |
boolean
|
<optional> |
false | When true, the URL omits the
|
If room is not created or fileId is missing.
Error
A Promise that resolves to the presigned URL.
Promise.<string>
Example
// Download URL (default)
const downloadUrl = await fileManager.getFileURL({ fileId: "abc123" });
// Inline streaming URL (for video playback, image preview, etc.)
const streamUrl = await fileManager.getFileURL({ fileId: "abc123", stream: true });
videoEl.src = streamUrl;
# getLocalAudioConstraints() → {AudioConstraints|null}
Get the current local audio constraints
The audio constraints object, or null if not set
AudioConstraints
|
null
Example
const constraints = client.getLocalAudioConstraints();
console.log('Echo cancellation:', constraints?.echoCancellation);
# getLocalAudioInputDeviceId() → {string|null}
Get the local audio input device id
The local audio input device id, or null if not set
string
|
null
Example
const micId = client.getLocalAudioInputDeviceId();
console.log('Current microphone:', micId);
# getLocalVideoDeviceId() → {string|null}
Get the local video device id
The local video device id, or null if not set
string
|
null
Example
const cameraId = client.getLocalVideoDeviceId();
console.log('Current camera:', cameraId);
# async getLookupUrls() → {Promise.<(Object|undefined)>}
Get lookup URLs from the signaling server
Lookup URLs if signaling is available
Promise.<(Object|undefined)>
Example
const urls = await client.getLookupUrls();
console.log('Lookup URLs:', urls);
# async getPublicFiles(params) → {Promise.<{files: Array.<object>}>}
List public files visible to the caller. Requires the public-files role
on the caller's UserProfile.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
params |
object
|
||
userId |
string
|
||
brandOrgId |
string
|
<optional> |
Optional brand-org scope narrowing. |
Promise.<{files: Array.<object>}>
# getRecordingId() → {string|null}
Get the current recording ID Only the room owner can start and stop recording and get the recordingId
The recording ID, or null if not recording
string
|
null
Example
const recordingId = client.getRecordingId();
if (recordingId) {
console.log('Currently recording:', recordingId);
}
# async getRecordingUrls(options) → {Promise.<Array>}
Get the recording urls This will get the recording urls for recordingId
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
recordingId |
string
|
the id of the recording to get the urls for |
roomName |
string
|
the name of the room |
userId |
string
|
the id of the user |
a Promise that resolves to the recording urls
Promise.<Array>
Example
// Get individual recording URLs for each participant
const urls = await client.getRecordingUrls({
recordingId: 'rec123',
roomName: 'my-room',
userId: 'user456'
});
urls.forEach(url => console.log('Recording:', url));
# async getRelayToken(options) → {Promise.<{token: string, url: string, certHashes: Array.<{algorithm: string, valueHex: string}>, expiresAt: number}>}
Mint a semantic-relay JWT for the given room. The semantic relay
is a WebTransport pub/sub service used for instrument note events,
annotation strokes, presenter-sync state, and similar low-latency
topics. The returned bundle is what you pass to
<SemanticRelayProvider> / SemanticRelayClient.
Two auth modes:
- Authenticated (default): uses the client's
roomToken, which was already established when the client created or joined the room. Pass{ roomName, userId, roomRegion }. - Guest: pass
{ roomName, joinToken, userId, roomRegion, password? }. The signing server DB-verifies the joinToken; the signeduserIdis forced to aguest:<uuid>namespace.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
Object
|
||
roomName |
string
|
Room name to scope the token to. |
|
userId |
string
|
User id (for auth) or supplied
joinUserId (for guest; signed claim is overridden to guest: |
|
roomRegion |
string
|
Room region (e.g. 'us-west-2'). |
|
joinToken |
string
|
<optional> |
Guest-only. |
password |
string
|
<optional> |
Optional joinToken password. |
Promise.<{token: string, url: string, certHashes: Array.<{algorithm: string, valueHex: string}>, expiresAt: number}>
Examples
// Authenticated (caller already joined the room via createRoom/joinRoom):
const bundle = await client.getRelayToken({
roomName: room.roomName,
userId: room.userId,
roomRegion: room.roomRegion,
});
// Guest (caller arrived via invite link):
const bundle = await client.getRelayToken({
roomName: room.roomName,
userId: 'guest-display-name',
roomRegion: 'us-west-2',
joinToken: params.get('joinToken'),
});
# getRemoteUserMediaStatus(userId) → {Object}
Get the media status of a remote participant
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
string
|
The user ID of the remote participant |
The media status
Object
Example
const status = client.getRemoteUserMediaStatus('user123');
if (!status.hasVideo) {
showAudioOnlyAvatar('user123');
}
# async getRoomNameFromToken(options) → {Promise.<Object>}
Get the room name from a join token without joining the room. Useful for retrieving room information before joining.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
Object
|
The options object |
|
joinToken |
string
|
The join token created by the room owner |
|
password |
string
|
<optional> |
Optional password for the token |
userId |
string
|
The id of the user |
|
roomRegion |
string
|
The region of the room |
If token is invalid or room not found
Error
Object containing roomName and isActive status
Promise.<Object>
Example
const { roomName, isActive } = await client.getRoomNameFromToken({
joinToken: params.get('token'),
roomRegion: params.get('region'),
userId: 'guest789'
});
if (isActive) {
showJoinButton(roomName);
} else {
showRoomInactiveMessage();
}
# async getRoomSummary(fileId) → {Promise.<Object>}
Get additional data for the room summary
Parameters:
| Name | Type | Description |
|---|---|---|
fileId |
string
|
If room is not created or roomId is missing
Error
a Promise that resolves to the room summary data
Promise.<Object>
# async getRoomUserIds() → {Promise.<Array.<string>>}
Get the userIds who have at some point been in this room, useful for offline resource sharing
If not room owner or room not created
Error
Array of userIds who have been in this room
Promise.<Array.<string>>
Example
// Get all users who have participated in this room
const userIds = await client.getRoomUserIds();
console.log('Past participants:', userIds);
# async getSignedCompositionUrl(options) → {Promise.<String>}
Get the signed composition url This will get the signed composition url which can be used to download the composition NOTE this can also be used to get a signed url for recordingUrls to download the individual recordings NOTE this url will expire after a short period of time
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
url |
string
|
the url to get the signed composition url for |
a Promise that resolves to the signed composition url
Promise.<String>
Example
// Get a signed URL for downloading a composition
const compositionUrl = await client.getCompositionUrl({...});
const signedUrl = await client.getSignedCompositionUrl({
url: compositionUrl
});
window.location.href = signedUrl; // Trigger download
# async getStats() → {Promise.<Object>}
Get comprehensive statistics about the client's transports and devices
If no room has been created yet
Error
Object containing transport stats and device information
Promise.<Object>
Example
// Display connection stats in debug panel
const stats = await client.getStats();
console.log('Transport stats:', stats);
# getStreamingId() → {string|null}
Get the current streaming ID Only the room owner can start and stop streaming and get the streamingId
The streaming ID, or null if not streaming
string
|
null
Example
const streamingId = client.getStreamingId();
if (streamingId) {
console.log('Currently streaming:', streamingId);
}
# async getStreamingUrls(options) → {Promise.<Array>}
Get the streaming urls This will get the streaming urls for streamingId
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
streamingId |
string
|
the id of the streaming to get the urls for |
roomName |
string
|
the name of the room |
userId |
string
|
the id of the user |
a Promise that resolves to the streaming urls
Promise.<Array>
Example
// Get streaming playback URLs
const urls = await client.getStreamingUrls({
streamingId: 'stream123',
roomName: 'my-room',
userId: 'user456'
});
console.log('Stream URLs:', urls);
# async getSymbols()
Get symbols, synbols are the files such as svg's that can be displayed in the whiteboard.
# getTranscribingId() → {string|null}
Get the current transcribing ID Only the room owner can start and stop transcribing and get the transcribingId
The transcribing ID, or null if not transcribing
string
|
null
Example
const transcribingId = client.getTranscribingId();
if (transcribingId) {
console.log('Transcription active:', transcribingId);
}
# async getTranscriptionStatus(options) → {Promise.<String>}
Get the status of a transcription This will get the status of a transcription
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
recordingId |
string
|
the id of the recording |
roomName |
string
|
the name of the room |
userId |
string
|
the id of the user |
a Promise that resolves to the transcription status
Promise.<String>
Example
// Check transcription status
const status = await client.getTranscriptionStatus({
recordingId: 'rec123',
roomName: 'my-room',
userId: 'user456'
});
console.log('Transcription status:', status);
# async getTranscriptionSummary(options) → {Promise.<Object>}
Get the transcription summary This will get the transcription summary for a recording
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
recordingId |
string
|
the id of the recording to get the transcription summary for |
userId |
string
|
the id of the user |
a Promise that resolves to the transcription summary
Promise.<Object>
Example
// Display meeting summary after transcription completes
const summary = await client.getTranscriptionSummary({
recordingId: 'rec123',
userId: 'user456'
});
document.getElementById('summary').textContent = summary.text;
# async getUsersFileTypes() → {Promise.<Array.<string>>}
Get the distinct resource types of files available to the current user
If room is not created
Error
A Promise that resolves to an array of resource type strings
Promise.<Array.<string>>
Example
const fileTypes = await fileManager.getUsersFileTypes();
console.log("Available file types:", fileTypes);
// Example output: ["document", "image", "presentation"]
# async getUsersFilesOfType(options) → {Promise.<Array.<FileMetadata>>}
Get all files of a specific resource type available to the current user
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
resourceType |
string
|
The type of resource to filter by (e.g., "presentation", "document") |
If room is not created
Error
A Promise that resolves to an array of matching file metadata
Promise.<Array.<FileMetadata>>
Example
const presentations = await fileManager.getUsersFilesOfType({
resourceType: "presentation"
});
console.log(`Found ${presentations.length} presentations`);
# async initFileOps(options) → {Promise.<void>}
Initialize lightweight credentials for file operations without creating a full room. This detects the best region and obtains a user token via HTTP — no WebSocket connection is established. Call this instead of createRoom/joinRoom when you only need to perform file management operations (delete, rename, move, share, etc.).
If a room is already created (signaling active), this is a no-op.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
Object
|
||
userId |
string
|
The user ID to authenticate with |
|
roomRegion |
string
|
<optional> |
Optional region override (auto-detected if omitted) |
Promise.<void>
Example
const client = new Client({ roomToken: 'your-token' });
await client.initFileOps({ userId: 'user@example.com' });
await client.shareFile({ fileId: 'abc', userIds: ['other@example.com'], sharedRoom: 'my-room' });
# isAudioOnly() → {boolean}
Check if the client is in audio-only mode (no video producer)
true if in audio-only mode
boolean
Example
if (client.isAudioOnly()) {
hideCameraControls();
}
# isAudioOutputSelectionSupported() → {boolean}
Check if audio output device selection is supported by the browser
True if setSinkId is supported
boolean
Example
if (client.isAudioOutputSelectionSupported()) {
showSpeakerSelector();
} else {
console.log('Speaker selection not supported');
}
# isConnected() → {boolean}
Check if the client is connected to the media server
True if connected, false otherwise
boolean
Example
if (client.isConnected()) {
console.log('Connected to room');
await client.sendChatMessage({ message: 'Hello!' });
} else {
console.log('Not connected - attempting to reconnect');
}
# isLocalAudioPaused() → {boolean}
Check if the local audio is paused
true if the audio is paused
boolean
Example
const micBtn = document.getElementById('mic-btn');
micBtn.classList.toggle('muted', client.isLocalAudioPaused());
# isLocalOutputPaused() → {boolean}
Check if the local audio output is paused (speakers muted)
true if the output is muted
boolean
Example
const speakerBtn = document.getElementById('speaker-btn');
speakerBtn.classList.toggle('muted', client.isLocalOutputPaused());
# isLocalUserRoomOwner() → {boolean}
Check if the local user is the room owner
If no room has been created yet
Error
True if the local user is the room owner
boolean
Example
if (client.isLocalUserRoomOwner()) {
// Show host controls
showRecordingButton();
showMuteAllButton();
}
# isLocalVideoPaused() → {boolean}
Check if the local video is paused
true if the video is paused
boolean
Example
const camBtn = document.getElementById('cam-btn');
camBtn.classList.toggle('off', client.isLocalVideoPaused());
# isRemoteUserAudioOnly(userId) → {boolean}
Check if a remote participant is in audio-only mode (has audio but no video)
Parameters:
| Name | Type | Description |
|---|---|---|
userId |
string
|
The user ID of the remote participant |
True if user has audio but no video
boolean
Example
if (client.isRemoteUserAudioOnly('user123')) {
showAudioOnlyIndicator('user123');
}
# isScreenShareActive() → {boolean}
Check if screen sharing is active
True if screen sharing is active
boolean
Example
const shareBtn = document.getElementById('share-btn');
shareBtn.textContent = client.isScreenShareActive() ? 'Stop Sharing' : 'Share Screen';
# async joinNoVideoRoom(options) → {Promise.<Room>}
Join an existing audio-only room with no video
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
roomName |
string
|
The name of the room to join |
userId |
string
|
The user ID of the joining user |
If room join fails
Error
The joined room object
Promise.<Room>
Example
const room = await client.joinNoVideoRoom({
roomName: 'audio-conference',
userId: 'participant456'
});
console.log('Joined audio-only room:', room.name);
# async joinRoom(options) → {Promise.<Room>}
Join an existing room. Note that roomNames and userIds are cleaned to remove non-alphanumeric characters (except _).
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
Object
|
The options object |
|
roomName |
string
|
The name of the room |
|
userId |
string
|
The id of the user |
|
externalUserId |
string
|
<optional> |
Optional application-specific user id |
If room join fails
Error
The joined room object
Promise.<Room>
Example
try {
const room = await client.joinRoom({
roomName: 'team-standup',
userId: 'participant456',
externalUserId: 'app-user-xyz'
});
console.log('Joined room:', room.name);
} catch (err) {
console.error('Failed to join room:', err.message);
}
# async joinRoomWithToken(options) → {Promise.<Room>}
Join an existing room using a join token created by the room owner.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
Object
|
The options object |
|
joinToken |
string
|
The join token created by the room owner |
|
password |
string
|
<optional> |
Optional password for the token |
userId |
string
|
The id of the user joining the room |
|
roomRegion |
string
|
The region of the room (from createJoinToken response) |
If room join fails or token is invalid
Error
The joined room object
Promise.<Room>
Example
// Parse token and region from invite URL
const params = new URLSearchParams(window.location.search);
const room = await client.joinRoomWithToken({
joinToken: params.get('token'),
roomRegion: params.get('region'),
userId: 'guest789'
});
# joinRoomWithTokenAndWait(options) → {Object}
Join a room with a token, waiting for the room owner to start the meeting if necessary.
This method will poll the server to check if the room is active (owner has joined). If the room is already active, it joins immediately. Otherwise, it waits until the room becomes active or the timeout is reached.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options |
Object
|
The options object. |
||
joinToken |
string
|
The join token created by the room owner. |
||
password |
string
|
An optional password for the room. |
||
userId |
string
|
The id of the user joining the room. |
||
roomRegion |
string
|
The region of the room (obtained from room owner with the join token). |
||
timeout |
number
|
<optional> |
300000 | Maximum time to wait in milliseconds (default: 5 minutes). |
pollingInterval |
number
|
<optional> |
3000 | How often to check if room is active in milliseconds (default: 3 seconds). |
- ClientEvents.WAIT_FOR_HOST_STARTED - When waiting begins (room not yet active)
- ClientEvents.event:WAIT_FOR_HOST_ROOM_READY - When room becomes active and join is starting
- ClientEvents.event:WAIT_FOR_HOST_TIMEOUT - When timeout is reached without room becoming active
- ClientEvents.event:WAIT_FOR_HOST_CANCELLED - When wait is cancelled via abortController
An object containing:
- abortController: Call abortController.abort() to cancel the wait
- promise: Resolves with the Room object when joined, or rejects on timeout/error
Object
Example
// Basic usage
const { abortController, promise } = client.joinRoomWithTokenAndWait({
joinToken: 'abc123',
userId: 'user1',
roomRegion: 'us-east-1',
timeout: 300000 // 5 minutes
});
// Listen for status events
client.addEventListener('wait-for-host-started', (e) => {
showUI(`Waiting for host to start "${e.detail.roomName}"...`);
});
client.addEventListener('wait-for-host-room-ready', () => {
showUI('Host has started the meeting, joining...');
});
// Cancel button handler
cancelButton.onclick = () => abortController.abort();
// Await the result
try {
const room = await promise;
console.log('Joined room:', room.name);
} catch (err) {
if (err.name === 'AbortError') {
console.log('User cancelled');
} else {
console.error('Failed to join:', err.message);
}
}
# async listAudioInputDevices() → {Promise.<Array.<MediaDeviceInfo>>}
Return a list of all the audio input devices available. Uses centralized MediaDeviceManager for cross-browser compatibility.
Array of available audio input devices
Promise.<Array.<MediaDeviceInfo>>
Example
const mics = await client.listAudioInputDevices();
mics.forEach(mic => {
console.log(`${mic.label} (${mic.deviceId})`);
});
# async listAudioOutputDevices() → {Promise.<Array.<MediaDeviceInfo>>}
Return a list of all the audio output devices available. Uses centralized MediaDeviceManager for cross-browser compatibility.
Array of available audio output devices
Promise.<Array.<MediaDeviceInfo>>
Example
const speakers = await client.listAudioOutputDevices();
speakers.forEach(spk => {
console.log(`${spk.label} (${spk.deviceId})`);
});
# async listVideoDevices() → {Promise.<Array.<MediaDeviceInfo>>}
Enumerate all video devices, even if they're busy. Uses centralized MediaDeviceManager for cross-browser compatibility.
Array of available video input devices
Promise.<Array.<MediaDeviceInfo>>
Example
const cameras = await client.listVideoDevices();
cameras.forEach(cam => {
console.log(`${cam.label} (${cam.deviceId})`);
});
# mergeAudioInput(options)
Merge a new audio stream into the current audio channel being sent to remote peers. Useful for adding background music or other audio streams.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
stream |
MediaStream
|
The audio stream to merge |
- ClientEvents.event:AUDIO_STREAM_ADDED
If audio merging is not enabled or stream is missing
Error
Example
// Add background music to the call
const audio = new Audio('background-music.mp3');
const musicStream = audio.captureStream();
client.mergeAudioInput({ stream: musicStream });
# async modifyFile(options) → {Promise.<FileMetadata>}
Modify a file in the room storage by replacing it with a new version
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
Object
|
The options object |
|
file |
File
|
The file containing new content |
|
fileId |
string
|
The ID of the file to modify |
|
appData |
Object
|
<optional> |
Optional application-specific metadata to associate with the file (will overwrite any existing appData) |
If room is not created or file is missing
Error
A Promise that resolves to the modified file metadata
Promise.<FileMetadata>
Example
await fileManager.modifyFile({
file: updatedFileObject,
fileId: "abc123"
});
The file object must contain:
- type: the file extension
- mimeType: the file mime type
- name: the file name
- owner: the file owner
# async moveFile(options) → {Promise.<FileMetadata>}
Move a file to a new location in the user's storage
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
fileId |
string
|
ID of the file to move |
newLocation |
string
|
New path location for the file |
If room is not created, fileId is missing, or newLocation is missing
Error
A Promise that resolves to the updated file metadata
Promise.<FileMetadata>
Example
await fileManager.moveFile({
fileId: "abc123",
newLocation: "/archive/2024"
});
# async muteLocalAudio(muteAudio, overRideopt) → {Promise.<Object>}
Mute or unmute the local audio
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
muteAudio |
boolean
|
true to mute, false to unmute |
|
overRide |
boolean
|
<optional> |
Internal use only, allows overriding room owner mute |
- ClientEvents.event:AUDIO_MUTED
Resolves when the audio is muted or unmuted
Promise.<Object>
Example
// Toggle microphone mute
document.getElementById('mic-btn').onclick = async () => {
const isMuted = client.isLocalAudioPaused();
await client.muteLocalAudio(!isMuted);
};
# async muteLocalOutput(muteOutput, overRideopt) → {Promise.<Object>}
Mute or unmute the local audio output. Note: For this to work, all remote video elements must have an ID starting with 'remote-video-'
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
muteOutput |
boolean
|
true to mute, false to unmute |
|
overRide |
boolean
|
<optional> |
Internal use only, allows overriding room owner mute |
- ClientEvents.event:OUTPUT_MUTED
Resolves when the output is muted or unmuted
Promise.<Object>
Example
// Toggle speaker mute
document.getElementById('speaker-btn').onclick = async () => {
const isMuted = client.isLocalOutputPaused();
await client.muteLocalOutput(!isMuted);
};
# async muteLocalVideo(muteVideo, overRideopt) → {Promise.<Object>}
Mute or unmute the local video
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
muteVideo |
boolean
|
true to mute, false to unmute |
|
overRide |
boolean
|
<optional> |
Internal use only, allows overriding room owner mute |
- ClientEvents.event:VIDEO_MUTED
Resolves when the video is muted or unmuted
Promise.<Object>
Example
// Toggle camera on/off
document.getElementById('cam-btn').onclick = async () => {
const isOff = client.isLocalVideoPaused();
await client.muteLocalVideo(!isOff);
};
# async muteRemoteAudio(options) → {Promise.<Object>}
Mute or unmute a remote user's audio. Can only be used by the room owner.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
room |
Room
|
The room object |
userId |
string
|
The id of the user to mute |
muteAudio |
boolean
|
true to mute, false to unmute |
- ClientEvents.event:REMOTE_AUDIO_MUTED
If not room owner or room not created
Error
Resolves when the mute command is sent
Promise.<Object>
Example
// Host mutes a participant's microphone
if (client.isLocalUserRoomOwner()) {
await client.muteRemoteAudio({ room, userId: 'user123', muteAudio: true });
}
# async muteRemoteOutput(options) → {Promise.<Object>}
Mute or unmute a remote user's audio output. Can only be used by the room owner.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
room |
Room
|
The room object |
userId |
string
|
The id of the user to mute |
muteOutput |
boolean
|
true to mute, false to unmute |
- ClientEvents.event:REMOTE_OUTPUT_MUTED
If not room owner or room not created
Error
Resolves when the mute command is sent
Promise.<Object>
Example
// Host mutes a participant's speakers
if (client.isLocalUserRoomOwner()) {
await client.muteRemoteOutput({ room, userId: 'user123', muteOutput: true });
}
# async muteRemoteVideo(options) → {Promise.<Object>}
Mute or unmute a remote user's video. Can only be used by the room owner.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
room |
Room
|
The room object |
userId |
string
|
The id of the user to mute |
muteVideo |
boolean
|
true to mute, false to unmute |
- ClientEvents.event:REMOTE_VIDEO_MUTED
If not room owner or room not created
Error
Resolves when the mute command is sent
Promise.<Object>
Example
// Host turns off a participant's camera
if (client.isLocalUserRoomOwner()) {
await client.muteRemoteVideo({ room, userId: 'user123', muteVideo: true });
}
# async ready() → {Promise.<Client>}
Wait for the client to be fully ready for operations. This includes browser-specific delays for Chrome/Edge/Safari that ensure device enumeration works reliably after construction.
Resolves with the client when ready
Promise.<Client>
Example
const client = new Client({ roomToken: 'your-token' });
await client.ready(); // Wait for browser-specific initialization
const devices = await client.listVideoDevices(); // Now safe to enumerate
# async reconnect(params) → {Promise.<void>}
Force a reconnection for a bad connection. Can be used internally or called directly to reset the connection.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
params |
Object
|
The parameters object |
|
options |
ConnectTransportsOptions
|
<optional> |
Additional options (overrides connectTransports options) |
waitingRoomToken |
string
|
<optional> |
Token for waiting room if applicable |
Resolves when media devices are reconnected
Promise.<void>
Example
client.addEventListener(ClientEvents.DISCONNECTED, async () => {
console.log('Connection lost, attempting reconnect...');
await client.reconnect({ options: { enableGainControl: true } });
});
# async rejectWaitingRoomUser(options) → {Promise.<void>}
Reject a user from the waiting room
This can only be called by the room owner and if the room is in waiting room mode
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
userToReject |
string
|
the id of the user to reject |
Resolves when the user is rejected
Promise.<void>
Example
// Reject a user from the waiting room
await client.rejectWaitingRoomUser({ userToReject: 'user123' });
# async sendChatMessage(options) → {Promise.<void>}
Send a chat message to other users in the room.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
message |
string
|
The message to send (stringify non-string values) |
- ClientEvents.event:RECEIVE_CHAT_MESSAGE
If room not created or message is missing
Error
Resolves when the message is sent
Promise.<void>
Example
// Send a text message to all participants
document.getElementById('send-btn').onclick = async () => {
const text = document.getElementById('chat-input').value;
await client.sendChatMessage({ message: text });
};
# async sendDataMessage(options) → {Promise.<void>}
Send a data message to a specific user or to all users in the room.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
options |
Object
|
The options object |
||
userId |
string
|
<optional> |
The id of the user to send to, or null for all users |
|
message |
Object
|
The message object to send |
||
preventReturn |
boolean
|
<optional> |
false | Prevent message from echoing back to sender |
- ClientEvents.event:DATA_MESSAGE
If room not created or message is missing
Error
Resolves when the message is sent
Promise.<void>
Example
// Send custom data to all participants
await client.sendDataMessage({
message: { type: 'cursor', x: 100, y: 200 }
});
// Or send to specific user
await client.sendDataMessage({
userId: 'user123',
message: { type: 'private', data: 'hello' }
});
# setActiveRoom(roomName)
Switch the active room name for an existing no-video room connection. This allows file operations (uploadFile, modifyFile, etc.) to target a different room without tearing down and re-establishing the signaling connection. Only works when a no-video room is already connected.
Parameters:
| Name | Type | Description |
|---|---|---|
roomName |
string
|
The room name to switch to |
If no signaling connection exists
Error
Example
await client.createNoVideoRoom({ roomName: 'room-a', userId: 'user1' });
// later, switch to a different room for file ops
client.setActiveRoom('room-b');
await client.uploadFile({ file, location: '/' });
# setAudioMode(mode)
Set the audio mode for optimized constraints
Parameters:
| Name | Type | Description |
|---|---|---|
mode |
string
|
Audio mode: 'default', 'music', 'presentation', or 'custom' |
Example
// Set to music mode for better fidelity without echo cancellation
client.setAudioMode('music');
// Set to presentation mode for optimized voice with echo cancellation
client.setAudioMode('presentation');
# async setAudioOutputDevice(options) → {Promise.<{success: boolean, updatedElements: number, errors: Array}>}
Set the local audio output device
This will apply the audio output device to all remote video/audio elements using setSinkId. If currently connected, all existing remote media elements will be updated.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
audioOutputDeviceId |
string
|
The id of the audio output device to use. |
- ClientEvents.event:AUDIO_OUTPUT_DEVICE_CHANGED - Emitted when the audio output device is changed
Result of applying the output device
Promise.<{success: boolean, updatedElements: number, errors: Array}>
Example
const speakers = await client.listAudioOutputDevices();
const result = await client.setAudioOutputDevice({
audioOutputDeviceId: speakers[0].deviceId
});
console.log(`Updated ${result.updatedElements} elements`);
# setCustomAudioConfig(config)
Set custom audio configuration
Parameters:
| Name | Type | Description |
|---|---|---|
config |
Object
|
Custom audio constraints |
Example
client.setCustomAudioConfig({
echoCancellation: true,
noiseSuppression: false,
autoGainControl: true
});
# setFileOpsRoomName(roomName)
Update the room name used for file operations when not in an active room. Call this to change the room context for subsequent file operations (e.g., uploadFile, createFolder) without re-initializing file ops.
Parameters:
| Name | Type | Description |
|---|---|---|
roomName |
string
|
The room name to use for file operations |
# async setLocalAudioInputDevice(options) → {Promise.<(MediaStream|null)>}
Set the local audio input device
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
Object
|
The options object |
|
audioInputDeviceId |
string
|
The id of the audio input device to use |
|
constraints |
AudioConstraints
|
<optional> |
The audio constraints to apply |
force |
boolean
|
<optional> |
Force the change even if device is the same (internal use) |
The media stream, or null if not connected
Promise.<(MediaStream|null)>
Example
const mics = await client.listAudioInputDevices();
await client.setLocalAudioInputDevice({
audioInputDeviceId: mics[0].deviceId,
constraints: { echoCancellation: true }
});
# async setLocalVideoDevice(options)
Set the local video device, if we are connected, update the stream and attach it to the video element
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
videoDeviceId |
string
|
The id of the video device to use. |
the media stream
Example
const cameras = await client.listVideoDevices();
await client.setLocalVideoDevice({
videoDeviceId: cameras[1].deviceId // Switch to second camera
});
# async shareFile(options) → {Promise.<FileMetadata>}
Share a file with other users in the room
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
fileId |
string
|
ID of the file to share |
userIds |
Array.<string>
|
Array of user IDs to share with, empty array removes all shares |
sharedRooom |
string
|
a room name to be included in the room share list (allows a file owned by a different room to be shared in this room) |
If room is not created, fileId is missing, or userIds is not an array
Error
A Promise that resolves to the updated file metadata
Promise.<FileMetadata>
Example
// Share a file with two users
await fileManager.shareFile({
fileId: "abc123",
userIds: ["user1", "user2"]
});
// Remove all sharing
await fileManager.shareFile({
fileId: "abc123",
userIds: []
});
# async startComposition(options) → {Promise.<void>}
Start composing the recording into a grid This will start composing the recording into a grid Note: Only the room owner can start composition
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
recordingId |
string
|
the id of the recording to compose |
a Promise that resolves when the composition is started
Promise.<void>
Example
// Start composition after recording stops
const recordingId = client.getRecordingId();
await client.stopRecording();
await client.startComposition({ recordingId });
# async startRecording(params) → {Promise.<string>}
Start recording the room This will start recording the room and all users will be recorded Note: Only the room owner can start recording and recording cannot be started if streaming is in progress
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
params |
Object
|
The parameters object. |
||
type |
string
|
<optional> |
'cloud' | the type of recording to start - currently only 'cloud' is supported |
options |
RecordingOptions
|
<optional> |
the options for the recording |
|
options.autoCompose |
boolean
|
<optional> |
false | If true, will automatically start composing the recording into a grid when the recording is stopped. |
options.transcribe |
boolean
|
<optional> |
false | If true, will automatically start live transcriptions as well as recording |
options.postMeetingSummary |
boolean
|
<optional> |
false | if true and transcribe is also true, will automatically generate a post meeting summary after the meeting ends |
options.useContext |
boolean
|
<optional> |
false | if true and it can only be true if transcribe is also true, the recording & transcribe bot will push transcriptions to AI for query access |
options.legacy |
boolean
|
<optional> |
false | If true, will use the legacy recording system |
A Promise that resolves with the recordingId when the recording is started.
Promise.<string>
Example
// Start cloud recording with live transcription
document.getElementById('record-btn').onclick = async () => {
try {
const recordingId = await client.startRecording({
type: 'cloud',
options: {
autoCompose: true,
transcribe: true,
postMeetingSummary: true
}
});
console.log('Recording started:', recordingId);
} catch (err) {
console.error('Failed to start recording:', err.message);
}
};
# async startScreenShare() → {Promise.<void>}
Start screen sharing. This will replace the video of the local user with the screen share.
- ClientEvents.event:SCREEN_SHARE_STARTED
Resolves when screen sharing has started
Promise.<void>
Example
document.getElementById('share-btn').onclick = async () => {
if (client.isScreenShareActive()) {
await client.stopScreenShare();
} else {
await client.startScreenShare();
}
};
# async startStreaming(params) → {Promise.<string>}
Start streaming the room This will start streaming the room and all users will be streamed. Note: Only the room owner can start streaming and streaming cannot be started if recording is in progress.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
params |
Object
|
The parameters object. |
||
type |
string
|
<optional> |
'cloud' | The type of streaming to start - currently only 'cloud' is supported. |
options |
Object
|
<optional> |
The streaming options. |
|
options.create_mp4 |
boolean
|
<optional> |
false | If true, creates an MP4 file from the stream when streaming stops. Note: Not supported when using rtmpUrl. |
options.mode |
string
|
<optional> |
'single' | Streaming mode: 'single' (default, focuses on one user) or 'multi' (shows multiple participants). |
options.rtmpUrl |
string
|
<optional> |
Custom RTMP URL for streaming to external platforms (e.g., YouTube, Twitch). If not provided, uses Hiyve cloud infrastructure. Note: create_mp4 is not supported when using rtmpUrl. |
If user is not the room owner.
Error
If room has not been created.
Error
If recording is in progress.
Error
If transcribing is in progress.
Error
If streaming is already in progress.
Error
A Promise that resolves with the streamingId when streaming has started.
Promise.<string>
Examples
// Start cloud streaming with MP4 file creation
document.getElementById('stream-btn').onclick = async () => {
try {
const streamingId = await client.startStreaming({
type: 'cloud',
options: { create_mp4: true }
});
console.log('Streaming started:', streamingId);
} catch (err) {
console.error('Failed to start streaming:', err.message);
}
};
// Start streaming to YouTube with multi-participant view
// Note: create_mp4 is not available when using rtmpUrl
const streamingId = await client.startStreaming({
type: 'cloud',
options: {
mode: 'multi',
rtmpUrl: 'rtmp://a.rtmp.youtube.com/live2/your-stream-key'
}
});
# async startTranscribing() → {Promise.<string>}
Start transcribing the room This will start transcribing the room and all users will be transcribed Note: Only the room owner can start transcribing and transcribing cannot be started if recording or streaming is in progress
A Promise that resolves to the recordingId of the transcription.
Promise.<string>
Example
// Start live transcription
document.getElementById('transcribe-btn').onclick = async () => {
try {
const transcribingId = await client.startTranscribing();
console.log('Transcription started:', transcribingId);
} catch (err) {
console.error('Failed:', err.message);
}
};
# async startTranscription(options) → {Promise.<void>}
Start transcribing and analysing the room recordings Note: This is different from the startTranscribing method which starts a live transcription This method will start a transcription for a recording that has already been made Note: Only the room owner can start transcriptions
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
recordingId |
string
|
the id of the recording to transcribe |
a Promise that resolves when the transcription is started
Promise.<void>
Example
// Start post-recording transcription
await client.startTranscription({ recordingId: 'rec123' });
// Then poll getTranscriptionStatus() until complete
# stopDevices()
Stop the local video and audio devices
This will stop the local video and audio devices and release camera/microphone access
Example
// Stop camera and microphone before leaving page
window.addEventListener('beforeunload', () => {
client.stopDevices();
});
# async stopRecording() → {Promise.<void>}
Stop recording the room This will stop recording the room Note: Only the room owner can stop recording
a Promise that resolves when the recording is stopped
Promise.<void>
Example
// Stop recording and get URLs
document.getElementById('stop-record-btn').onclick = async () => {
const recordingId = client.getRecordingId();
await client.stopRecording();
console.log('Recording stopped, use getRecordingUrls() to access files');
};
# async stopScreenShare() → {Promise.<void>}
Stop screen sharing This will stop the screen share and replace the video of the local user with the camera video
- ClientEvents.event:SCREEN_SHARE_STOPPED
Resolves when screen sharing has stopped
Promise.<void>
Example
await client.stopScreenShare();
console.log('Screen sharing stopped');
# async stopStreaming() → {Promise.<void>}
Stop streaming the room This will stop streaming the room Note: Only the room owner can stop streaming
a Promise that resolves when the streaming is stopped
Promise.<void>
Example
// Stop streaming
document.getElementById('stop-stream-btn').onclick = async () => {
await client.stopStreaming();
console.log('Streaming stopped');
};
# async stopTranscribing() → {Promise.<Object>}
Stop transcribing the room This will stop transcribing the room Note: Only the room owner can stop transcribing
A Promise that resolves when the transcription is stopped
Promise.<Object>
Example
// Stop transcription
document.getElementById('stop-transcribe-btn').onclick = async () => {
await client.stopTranscribing();
console.log('Transcription stopped');
};
# async switchStreamingUser(options) → {Promise.<Object>}
Switch the primary streaming user This allows the room owner to change which user is the focus of the stream Note: Only the room owner can switch streaming users
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
userToSwitchTo |
string
|
The userId to switch the stream focus to |
A Promise that resolves when the switch is complete
Promise.<Object>
Example
// Switch stream to a specific user
const switchToSpeaker = async (userId) => {
await client.switchStreamingUser({ userToSwitchTo: userId });
console.log('Stream now focused on:', userId);
};
# unmergeAudioInput(options)
Unmerge the audio stream (if one was merged in using mergeAudioInput)
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object. |
stream |
MediaStream
|
the audio stream to unmerge |
- ClientEvents.event:AUDIO_STREAM_REMOVED
Example
// Stop background music
client.unmergeAudioInput({ stream: musicStream });
# async updateFileAppData(options) → {Promise.<Object>}
Update application-specific metadata on a file without re-uploading content.
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
fileId |
string
|
ID of the file to update |
appData |
Object
|
New application data object |
If room is not created or required params are missing
Error
A Promise that resolves when appData is updated
Promise.<Object>
# async updateFilename(options) → {Promise.<FileMetadata>}
Update the filename of an existing file in the room storage
Parameters:
| Name | Type | Description |
|---|---|---|
options |
Object
|
The options object |
fileId |
string
|
The ID of the file to update |
newFilename |
string
|
The new filename to set |
If room is not created or fileId/newFilename is missing
Error
A Promise that resolves to the updated file metadata
Promise.<FileMetadata>
Example
await fileManager.updateFilename({
fileId: "abc123",
newFilename: "new-name.txt"
});
# async uploadFile(options) → {Promise.<FileMetadata>}
Upload a file to the room storage
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
options |
Object
|
The options object |
|
file |
File
|
The file to upload |
|
location |
string
|
Location path (e.g., "/" for root folder) to upload the file to |
|
resourceType |
string
|
<optional> |
Type of resource to upload, if not provided, the file type will be used |
appData |
Object
|
<optional> |
Optional application-specific metadata to associate with the file |
If room is not created or file is missing
Error
A Promise that resolves to the uploaded file metadata
Promise.<FileMetadata>
Example
const fileMetadata = await fileManager.uploadFile({
file: document.getElementById('fileInput').files[0],
location: "/documents",
resourceType: "presentation"
});
console.log(`Uploaded file with ID: ${fileMetadata.fileId}`);