Methods and Events
Methods

Methods

This document lists the methods available in the Samvyo SDK Instance, along with descriptions and code examples for implementation.

joinRoom()

Description

Joins a specified room using the provided session token and parameters.

async function joinRoom() {
  try {
    await samvyoInstance.joinRoom({
      sessionToken,
      roomId,
      peerName,
      produce: true, // Set to true to send audio/video streams
      consume: true, // Set to true to receive audio/video streams
      // Additional parameters can be added here as needed
    });
    console.log("Left the room.");
  } catch (error) {
    console.error("Error leaving the room:", error);
  }
}

Parameters

  • sessionToken: Token for authentication (required)
  • roomId: ID of the room you want to join (required)
  • roomDisplayName: The display name of a room you want to join. This can be used primarily for display purposes.(optional)
  • peerId: PeerId of the peer who wants to join the room (required)
  • peerName: Name of the peer (optional)
  • peerType: A role assigned to an user that can be used for controlling other user activities in a room. Ex. a moderator can leave / close a room but a regular user can only leave a room. Currently allowed roles are: moderator or participant or attendee. The default peerType is set to participant if not set explicitely.(optional)
  • roomType: The type of the room to join. Possible values are "conferencing", "event", or "p2p". Default is "conferencing". (optional)
  • videoResolution: The available values are "qvga" (320x240), "vga" (640x480), and "hd" (1280x720). Default value is "hd" (optional).
  • produce:Set to true if you want to send your audio and video streams to the room.
  • consume: Set to true if you want to receive audio and video streams from other participants in the room.
  • forcePCMU: This parameter forces the use of the PCMU audio codec.The default audio codec used in OPUS. PCMU is particulary useful in environments with varying network conditions, as it ensures stable audio quality and low latency. The default value of this setting is false.
  • forcePCMA: false/true, if the default audio codec need to be changed from opus to PCMA. THe default value of this setting is false.
  • forceVp8 : This parameter forces the use of forceVp8 video codec. Genearlly, the default video codec is VP8. This codec works well across different devices and network conditions. The default value of this setting is false.
  • forceVp9 : This parameter forces the use of forceVp9 video codec. Generally, the default video codec is VP8. This codec works well across different devices and network conditions. The default value of this setting is false.
  • forceH264: This parameter forces the use of H264 video codec for efficient compression and high-quality video streaming. The default video codec is VP8. This codec works well across different devices and network conditions. The default value of this setting is false.
  • h264Profile: This parameter specifies the H264 profile for video encoding, which decides the video compression quality. Common profiles were low and high. The default value of this setting is high.
  • forceFPS: This parameter sets the video frame rate, which directly affects the smoothness of the video. A higher frame rate requires more processing power but provides smoother motion, while low frame rate uses less resources results in a less smoother video. The default value of this setting is 25.
  • enableWebcamLayers: This parameter enables simulcast layers for the webcam, which allows different resolutions to be sent simultaneously. This feature ensures that participants with varying network conditions can receive the most appropriate video quality. The default value of this setting is true.
  • numSimulcastStreams: This parameter specifies the number of simulcast streams to produce, The default value of this setting is 3.
  • videoBitRates: This parameter control the bit rates for different simulcast layers, affecting the video quality and bandwith usage. You can adjust the bit rates to change the video quality for different layers. By default this setting will take 500, 200, 75 for high, medium and low bitrates respectively.
  • autoGainControl: This parameter enables automatic gain control for the microphone.This helps maintain consistent audio level by adjusting the microphone sensitivity in response to changes in speaking volume. This will be veryuseful when you move closer or further from the microphone The default value of this setting is true.
  • echoCancellation: This parameter when enabled prevents the feedback loop by detecting and eliminating the echo from the audio signal. It ensures that when someone speaks, their voice is not picked up by their own microphone and sent back to them or others in the call. By default this setting is true.
  • noiseSuppression: This parameter when enabled reduces background noise, ensuring that your voice remains clear even in noisy environments. By default this setting is true.
  • sampleRate : This parameter specifies the audio sample rate, which determines the quality of the audio stream. Higher sample rates(1600Hz) result in better audio but requires more processing power, while lower sample rates are efficient but result in lower audio quality.For PCMU, this setting should be set to 8000. Otherwise, default setting for this parameter is 44000.
  • channelCount: This parameter refers to the number of audio channels that are captured and transmitted in an audio stream. It determines whether the audio is mono (a single audio channel with the same signal sent to all speakers) or stereo (two audio channels, with one for the left speaker and one for the right). The OPUS codec supports both mono and stereo signals. Depending on the device's capabilities and CPU performance, the channel count can be increased to 2. The default setting for this parameter is 1 (mono).
  • share:This parameter is used for enabling/ disabling screen share, by default false
  • shareAudio: This parameter is used if audio also need to be shared along with screenshare wherever applicable. The default value of this setting is false. Share parameter should be true to consider this setting.
  • enableSharingLayers: true/false, if simulcast/svc needed to be enabled for better network speed based video quality adjustment, the default value is true. It advisable to keep this value as true for better screen sharing experience. Share parameter should be true to consider this setting.
  • shareBitrates:This parameter is applicable only if enablesharingLayers flag is true. Integer Array of 1 to 3 values to enforce a specific bitrate while transmitting the screen share video on the network. This is an advanced parameter for fine tuning screen sharing experience in case of a need. Don't changes this value if you are not very sure if fine tuning screen sharing is not an requirement for you. the default value is [2500,1250,500]
  • audioDeviceId: Provide the specific audiodeviceId from the audioInputs avaliable, with which you wish to start the call
  • videoDeviceId: Provide the specific videodeviceId from the videoInputs avaliable, with which you wish to start the call

leaveRoom()

Description

The leaveRoom method takes the samvyo instance as a parameter and asynchronously leaves the current room, logging a success or error message.

async function leaveRoom(samvyoInstance) {
  try {
    await samvyoInstance.leaveRoom();
    console.log("Left the room.");
  } catch (error) {
    console.error("Error leaving the room:", error);
  }
}

closeRoom()

Description

The closeRoom method takes the samvyo instance as a parameter and asynchronously closes the current room that will force leave all other users currently in room, logging a success or error message.

async function leaveRoom(samvyoInstance) {
  try {
    await samvyoInstance.closeRoom();
    console.log("Closed the room.");
  } catch (error) {
    console.error("Error closing the room:", error);
  }
}

mute()

Description

The mute method takes the samvyo instance as a parameter and mutes the local microphone, logging a success message.

function mute(samvyoInstance) {
  samvyoInstance.muteMic();
  console.log("Microphone muted.");
}

unMute()

Description

The unMute method takes the samvyo instance as a parameter and unmutes the local microphone, logging a success message.

function unMute(samvyoInstance) {
  samvyoInstance.unmuteMic();
  console.log("Microphone unmuted.");
}

cameraOn()

Description

The cameraOn method takes the samvyo instance as a parameter and turns on the local camera, logging a success message.

function cameraOn(samvyoInstance) {
  samvyoInstance.enableCam();
  console.log("Camera turned on.");
}

cameraOff()

Description

The cameraOff method takes the samvyo instance as a parameter and turns off the local camera, logging a success message.

function cameraOff(samvyoInstance) {
  samvyoInstance.disableCam();
  console.log("Camera turned off.");
}

listDevices()

Description

Get the list of currently available camera,Mic and speaker(in case of chrome!) in order to select a specific camera/mic before joining a room.

function listDevices() {
  const vidScaleClient = await VidScale.JsSdk;
  const availableDevices = await vidScaleClient.listDevices();
  if (availableDevices.success) {
    const audioDevices = availableDevices.deviceList.audioDevices;
    const videoDevices = availableDevices.deviceList.videoDevices;
  }
}

listAudioOutputDevices()

Description

Get the list of currently available audio output devices (speakers).

const devices = await samvyoInstance.listAudioOutputDevices();

changeVideoInput()

Description

Switch camera which is already being shared by an user to a new camera while providing a specific deviceId from the array of videoInputs available in the deviceList. The resolution and fps values can also be updated while changing the camera source.

function changeVideoInput(samvyoInstance) {
  await samvyoInstance.changeVideoInput({
    resolution,
     deviceId,
     fps
  })
}

Parameters

  • resolution: The available values are "qvga" (320x240), "vga" (640x480), and "hd" (1280x720). Default value is "vga" (optional).
  • deviceId: deviceId of the videoInput selected by the user (required)
  • fps: This parameter sets the video frame rate, which directly affects the smoothness of the video. A higher frame rate requires more processing power but provides smoother motion, while low frame rate uses less resources results in a less smoother video. The default value of this setting is 25.

changeAudioInput()

Description

Switch mic which is already being shared by an user to a new mic while providing a specific deviceId from the array of audioInputs available in the deviceList. Optionally Other mic specific input parameters can also be applied to this new input device. These options are not mandatory. If these options are not provided, they will fallback to the provided values / default values used at joining time.

function changeAudioInput(samvyoInstance) {
  await samvyoInstance.changeAudioInput({
    autoGainControl,
    echoCancellation,
    noiseSuppression,
    sampleRate,
    channelCount,
    deviceId
  })
}

Parameters

  • deviceId: deviceId of the audioInput selected by the user (required)
  • autoGainControl: This parameter enables automatic gain control for the microphone.This helps maintain consistent audio level by adjusting the microphone sensitivity in response to changes in speaking volume. This will be veryuseful when you move closer or further from the microphone The default value of this setting is true.
  • echoCancellation: This parameter when enabled prevents the feedback loop by detecting and eliminating the echo from the audio signal. It ensures that when someone speaks, their voice is not picked up by their own microphone and sent back to them or others in the call. By default this setting is true.
  • noiseSuppression: This parameter when enabled reduces background noise, ensuring that your voice remains clear even in noisy environments. By default this setting is true.
  • sampleRate : This parameter specifies the audio sample rate, which determines the quality of the audio stream. Higher sample rates(1600Hz) result in better audio but requires more processing power, while lower sample rates are efficient but result in lower audio quality.For PCMU, this setting should be set to 8000. Otherwise, default setting for this parameter is 44000.
  • channelCount: This parameter refers to the number of audio channels that are captured and transmitted in an audio stream. It determines whether the audio is mono (a single audio channel with the same signal sent to all speakers) or stereo (two audio channels, with one for the left speaker and one for the right). The OPUS codec supports both mono and stereo signals. Depending on the device's capabilities and CPU performance, the channel count can be increased to 2. The default setting for this parameter is 1 (mono).

enableCam()

Description

Enable camera either with a specific deviceId from the deviceList or with the 1st device available in the videoInput array of deviceList.

function enableCam(samvyoInstance) {
  await samvyoInstance.enableCam({
    deviceId,
    videoResolution,
    forceVp8,
    forceVp9,
    forceH264,
    h264Profile,
    forceFPS,
    enableWebcamLayers,
    numSimulcastStreams,
    videoBitRates
  })
}

Parameters

  • deviceId: deviceId of the videoInput selected by the user (required)
  • videoResolution: The available values are "qvga" (320x240), "vga" (640x480), and "hd" (1280x720). Default value is "hd" (optional).
  • forceVp8 : This parameter forces the use of forceVp8 video codec. Genearlly, the default video codec is VP8. This codec works well across different devices and network conditions. The default value of this setting is false.
  • forceVp9 : This parameter forces the use of forceVp9 video codec. Generally, the default video codec is VP8. This codec works well across different devices and network conditions. The default value of this setting is false.
  • forceH264: This parameter forces the use of H264 video codec for efficient compression and high-quality video streaming. The default video codec is VP8. This codec works well across different devices and network conditions. The default value of this setting is false.
  • h264Profile: This parameter specifies the H264 profile for video encoding, which decides the video compression quality. Common profiles were low and high. The default value of this setting is high.
  • forceFPS: This parameter sets the video frame rate, which directly affects the smoothness of the video. A higher frame rate requires more processing power but provides smoother motion, while low frame rate uses less resources results in a less smoother video. The default value of this setting is 25.
  • enableWebcamLayers: This parameter enables simulcast layers for the webcam, which allows different resolutions to be sent simultaneously. This feature ensures that participants with varying network conditions can receive the most appropriate video quality. The default value of this setting is true.
  • numSimulcastStreams: This parameter specifies the number of simulcast streams to produce, The default value of this setting is 3.
  • videoBitRates: This parameter control the bit rates for different simulcast layers, affecting the video quality and bandwith usage. You can adjust the bit rates to change the video quality for different layers. By default this setting will take 500, 200, 75 for high, medium and low bitrates respectively.

disableCam()

Description

Disables the mic when no more required. Be careful when disabling the mic because it will close the audio comunication and release the mic so that it can be used by some other application. If you just wish to mute the audio rather than disabling to keep the mic acquisition, then use the mute/ unmute functionality instead. In mute/unmute, the audio channel as well as the mic acquisition is not destroyed but kept alive so that anytime a user can use it in the future. mute/unmute is instant where as enabling a disabled mic may take upto 1 sec based on the availability of the mic. If the mic is not available, then audio can't be enabled again until the mic becomes available.

function disableCam(samvyoInstance) {
  await samvyoInstance.disableCam()
}

enableMic()

Description

Enable mic either with a specific deviceId from the deviceList or with the 1st device available in the audioInput array of deviceList.

function enableMic(samvyoInstance) {
  await samvyoInstance.enableMic({
    deviceId,
    autoGainControl,
    noiseSuppression,
    echoCancellation,
    channelCount,
    sampleRate,
    forcePCMU,
    forcePCMA
  })
}

Parameters

  • deviceId: deviceId of the audioInput selected by the user, if not provided mic will be enabled with default audioInput
  • autoGainControl: This parameter enables automatic gain control for the microphone.This helps maintain consistent audio level by adjusting the microphone sensitivity in response to changes in speaking volume. This will be veryuseful when you move closer or further from the microphone The default value of this setting is true.
  • noiseSuppression: This parameter when enabled reduces background noise, ensuring that your voice remains clear even in noisy environments. By default this setting is true.
  • echoCancellation: This parameter when enabled prevents the feedback loop by detecting and eliminating the echo from the audio signal. It ensures that when someone speaks, their voice is not picked up by their own microphone and sent back to them or others in the call. By default this setting is true.
  • channelCount: This parameter refers to the number of audio channels that are captured and transmitted in an audio stream. It determines whether the audio is mono (a single audio channel with the same signal sent to all speakers) or stereo (two audio channels, with one for the left speaker and one for the right). The OPUS codec supports both mono and stereo signals. Depending on the device's capabilities and CPU performance, the channel count can be increased to 2. The default setting for this parameter is 1 (mono).
  • sampleRate : This parameter specifies the audio sample rate, which determines the quality of the audio stream. Higher sample rates(1600Hz) result in better audio but requires more processing power, while lower sample rates are efficient but result in lower audio quality.For PCMU, this setting should be set to 8000. Otherwise, default setting for this parameter is 44000.
  • forcePCMU: This parameter forces the use of the PCMU audio codec.The default audio codec used in OPUS. PCMU is particulary useful in environments with varying network conditions, as it ensures stable audio quality and low latency. The default value of this setting is false.
  • forcePCMA: false/true, if the default audio codec need to be changed from opus to PCMA. THe default value of this setting is false.

disableMic()

Description

Disables the mic when no more required. Be careful when disabling the mic because it will close the audio comunication and release the mic so that it can be used by some other application. If you just wish to mute the audio rather than disabling to keep the mic acquisition, then use the mute/ unmute functionality instead. In mute/unmute, the audio channel as well as the mic acquisition is not destroyed but kept alive so that anytime a user can use it in the future. mute/unmute is instant where as enabling a disabled mic may take upto 1 sec based on the availability of the mic. If the mic is not available, then audio can't be enabled again until the mic becomes available.

function disableMic(samvyoInstance) {
  await samvyoInstance.disableMic()
}

enableShare()

Description

Call this function on the client object to start screen sharing. Screen share by default will be started with video only mode. If you wish to enable screen audio as well ,you need to set the shareAudio property to true. enableSharingLayers and sharingBitRates are for advance usage only when you wish to tweak the internal screen share video transmission capacity on the network. Leave these to default for optimal performance or check the advace usage section to know more about tweaking these parameters.

function enableShare(samvyoInstance) {
  await samvyoInstance.enableShare({
    shareAudio,
    enableSharingLayers,
    shareBitRates
  })
}

Parameters

  • shareAudio: If audio also need to be shared along with screenshare wherever applicable. The default value of this setting is 'false'.
  • enableSharingLayers: true/false, if simulcast/svc needed to be enabled for better network speed based video quality adjustment, the default value is true. It advisable to keep this value as true for better screen sharing experience
  • shareBitrates:This parameter is applicable only if enablesharingLayers flag is true. Integer Array of 1 to 3 values to enforce a specific bitrate while transmitting the screen share video on the network. This is an advanced parameter for fine tuning screen sharing experience in case of a need. Don't changes this value if you are not very sure if fine tuning screen sharing is not an requirement for you. the default value is [2500,1250,500]

disableShare()

Description

Disable the screen share if already enbaled currently. If not enabled already, calling this function has no effect.

function disableShare(samvyoInstance) {
  await samvyoInstance.disableShare()
}

startRecording()

Description

Call this function on the client object to start recording the current session. Recording by default will be started in the audio only mode, merged together as one mp3 file available in the dashboard under the storage section shorlty after the recording is stopped or room is closed. If you wish to record both audio and video together as one recording, you need to set the recordingType property as av for audio and video. By default, recordingType is set to a which is for audio only recording.

function enableShare(samvyoInstance) {
  await samvyoInstance.startRecording({
    recordingType
  })
}

Parameters

  • recordingType: The value will be av if you wish to record both audio and video as one recording. By default the value is set to a which is for recording audio only.

stopRecording()

Description

Stop the recording if already started currently. If not started already, calling this function has no effect.

function disableShare(samvyoInstance) {
  await samvyoInstance.stopRecording()
}

allowRoomJoin()

Description

Allows a moderator to grant permission for a user to join the room when moderator authentication is enabled. This method should only be called by users with moderator privileges.

async function allowUserToJoin(samvyoInstance, peerId) {
  try {
    await samvyoInstance.allowRoomJoin(peerId);
    console.log(`User ${peerId} has been allowed to join the room`);
  } catch (error) {
    console.error("Error allowing user to join:", error);
  }
}

Parameters

  • peerId: The ID of the peer who requested to join the room

denyRoomJoin()

Description

Allows a moderator to deny permission for a user to join the room when moderator authentication is enabled. This method should only be called by users with moderator privileges.

async function denyUserJoin(samvyoInstance, peerId) {
  try {
    await samvyoInstance.denyRoomJoin(peerId);
    console.log(`User ${peerId} has been denied access to the room`);
  } catch (error) {
    console.error("Error denying user access:", error);
  }
}

Parameters

  • peerId: The ID of the peer who requested to join the room

sendCustomMessage()

Description

Sends a custom message to participants in the room. This is useful for implementing chat, custom signaling, or application-specific events.

function sendMessage(samvyoInstance) {
  samvyoInstance.sendCustomMessage(
    "Hello World", // data
    "chat",       // type
    null,         // recieverPeerId (null for broadcast)
    "participant", // senderType
    "text",       // messageType
    { timestamp: Date.now() } // customData
  );
}

Example: Sending a Public Emoji Reaction

This example shows how to broadcast an emoji reaction to all participants in the room.

const sendEmojiReaction = (emoji) => {
  if (samvyoInstance.sendCustomMessage) {
    samvyoInstance.sendCustomMessage(
      JSON.stringify({
        type: "emoji-reaction",
        emoji: emoji.char, // e.g., "👍"
        emojiType: emoji.alt, // e.g., "thumbs up"
      }),
      "custom" // message type
    );
  }
  // You can also update your local UI here
};

Example: Sending Chat Messages

This example demonstrates how to send both public (to everyone) and private (to a specific peer) chat messages.

const sendChatMessage = async (messageText, receiverPeerId = null) => {
  if (!messageText.trim() || !samvyoInstance) return;
 
  try {
    // Determine if it's a private or public message based on receiverPeerId
    // If receiverPeerId is null, it's a public message to everyone
    const messageType = receiverPeerId ? "private" : "public";
 
    await samvyoInstance.sendCustomMessage(
      messageText,          // data: the actual message content
      "chat",               // type: categorizes this as a chat message
      receiverPeerId,       // recieverPeerId: specific peer ID or null for everyone
      "participant",        // senderType: usually "participant" or "moderator"
      messageType           // messageType: sub-type "private" or "public"
    );
 
    console.log("Message sent successfully");
  } catch (err) {
    console.error(`Failed to send message: ${err.message}`);
  }
};

Parameters

  • data: The main content of the message (required).
  • type: A string categorization for the message (default: "general").
  • recieverPeerId: The Peer ID of a specific recipient. Set to null to broadcast to all participants (default: null).
  • senderType: The type of the sender (e.g., "participant", "moderator").
  • messageType: A sub-type for the message classification.
  • customData: An object containing additional metadata.

startTranscription()

Description

Starts the speech-to-text transcription service for the current room.

samvyoInstance.startTranscription();

stopTranscription()

Description

Stops the active speech-to-text transcription service.

samvyoInstance.stopTranscription();

sendAudioForTranscription()

Description

Manually sends an audio buffer for transcription processing. This is particularly useful when implementing a custom audio pipeline or mixing multiple audio sources (like all remote participants) into a single stream for transcription.

Example: Mixing and Sending Audio

The following example demonstrates how to capture audio from all participants, mix it using the Web Audio API, and send chunks to the transcription service.

const audioContextRef = useRef(null);
const mixerDestinationRef = useRef(null);
const mixerRecorderRef = useRef(null);
const mixerSourceNodesRef = useRef(new Map());
const mixerGainNodesRef = useRef(new Map());
 
// 1. Initialize the Audio Context and Mixer Destination
const ensureTranscriptionAudioGraph = () => {
  if (!audioContextRef.current) {
    audioContextRef.current = new (window.AudioContext || window.webkitAudioContext)();
  }
  if (!mixerDestinationRef.current) {
    mixerDestinationRef.current = audioContextRef.current.createMediaStreamDestination();
  }
};
 
// 2. Add a Participant's Audio Track to the Mixer
const addTrackToTranscriptionMixer = (peerId, audioTrack) => {
  ensureTranscriptionAudioGraph();
  if (!audioContextRef.current || !mixerDestinationRef.current || !audioTrack) return;
  if (mixerSourceNodesRef.current.has(peerId)) return;
 
  const mediaStream = new MediaStream([audioTrack]);
  const source = new MediaStreamAudioSourceNode(audioContextRef.current, { mediaStream });
  const gainNode = audioContextRef.current.createGain();
 
  // Adjust gain (volume) as needed. E.g., lower for background, higher for active speaker
  gainNode.gain.value = 0.5;
 
  source.connect(gainNode).connect(mixerDestinationRef.current);
  
  mixerSourceNodesRef.current.set(peerId, source);
  mixerGainNodesRef.current.set(peerId, gainNode);
};
 
// 3. Start Recording the Mixed Stream and Sending Data
const startContinuousTranscription = (client) => {
  if (mixerRecorderRef.current) return;
  ensureTranscriptionAudioGraph();
  
  const stream = mixerDestinationRef.current.stream;
  const options = { mimeType: 'audio/webm;codecs=opus' };
  const recorder = new MediaRecorder(stream, options);
 
  recorder.ondataavailable = (event) => {
    if (event.data && event.data.size > 0) {
      const reader = new FileReader();
      reader.onload = () => {
        const base64Audio = reader.result.split(',')[1];
        // Send the audio chunk to the SDK
        client.sendAudioForTranscription(base64Audio, 'mixed-audio');
      };
      reader.readAsDataURL(event.data);
    }
  };
 
  // Send chunks every 1000ms (1 second)
  recorder.start(1000);
  mixerRecorderRef.current = recorder;
};

Parameters

  • audioBuffer: The base64 encoded audio data string (without data URI prefix).
  • peerId: The Peer ID associated with the audio (or a generic identifier like 'mixed-audio').

isTranscriptionActive()

Description

Checks if the transcription service is currently active.

const isActive = samvyoInstance.isTranscriptionActive();

startLiveStreaming()

Description

Starts live streaming the room to an external RTMP endpoint.

samvyoInstance.startLiveStreaming({
  streamUrl: "rtmp://live.example.com/app",
  streamKey: "secret-key",
  type: "rtmp" // optional
});

Parameters

  • streamUrl: The RTMP server URL.
  • streamKey: The stream key for authentication.
  • type: The streaming type (default inferred).

stopLiveStreaming()

Description

Stops the current live stream.

samvyoInstance.stopLiveStreaming();

startProcessing()

Description

Initiates processing of media files, such as converting or analyzing recorded content.

samvyoInstance.startProcessing({
  inputFiles: [{ type: "video", url: "https://..." }],
  outputQualities: ["720p"],
  bucket: "my-bucket",
  cloud: "aws",
  region: "us-east-1"
});

Parameters

  • inputFiles: Array of objects with type and url of files to process.
  • outputQualities: Array of desired output quality strings (e.g., "720p", "1080p").
  • bucket: Cloud storage bucket name.
  • cloud: Cloud provider name.
  • region: Cloud region.

checkProcessingStatus()

Description

Checks the status of a processing request.

const status = samvyoInstance.checkProcessingStatus({ requestId: 12345 });

Parameters

  • requestId: The ID of the processing request to check.

toggleVB()

Description

Toggles the virtual background feature on or off.

await samvyoInstance.toggleVB(true); // Enable
await samvyoInstance.toggleVB(false); // Disable

Parameters

  • status: Boolean, true to enable, false to disable.

setVBDetails()

Description

Configures the virtual background settings (e.g., blur or image).

await samvyoInstance.setVBDetails({
  type: "blur", // or "image"
  value: "blur-strength-medium" // or image URL
});

Parameters

  • vbDetails: Object containing virtual background configuration.

upgradeParticipant()

Description

Upgrades a participant to a presenter role (Moderator only).

samvyoInstance.upgradeParticipant(peerId, true, true);

Parameters

  • peerId: The ID of the peer to upgrade.
  • audioStatus: Boolean, whether to enable audio (default: true).
  • videoStatus: Boolean, whether to enable video (default: false).

downgradeParticipant()

Description

Downgrades a presenter back to a viewer/participant role (Moderator only).

samvyoInstance.downgradeParticipant(peerId);

Parameters

  • peerId: The ID of the peer to downgrade.

sendUpgradeRequest()

Description

Sends a request to a participant offering them an upgrade to presenter status.

samvyoInstance.sendUpgradeRequest(peerId, true);

Parameters

  • peerId: The ID of the participant.
  • status: Boolean, status of the request (default: true).

acceptUpgradeRequest()

Description

Accepts an upgrade request received from a moderator.

samvyoInstance.acceptUpgradeRequest(true, true);

Parameters

  • audioStatus: Boolean, enable audio upon upgrade.
  • videoStatus: Boolean, enable video upon upgrade.

rejectUpgradeRequest()

Description

Rejects an upgrade request received from a moderator.

samvyoInstance.rejectUpgradeRequest(moderatorPeerId);

Parameters

  • moderatorPeerId: The ID of the moderator who sent the request.

raiseHand()

Description

Raises the local user's hand to signal they want to speak.

samvyoInstance.raiseHand();

dropHand()

Description

Lowers a hand. Can be used by the user themselves or by a moderator to lower another user's hand.

samvyoInstance.dropHand(peerId); // Lower specific peer's hand
// or
samvyoInstance.dropHand(); // Lower own hand

Parameters

  • peerId: (Optional) The ID of the peer whose hand to lower. Defaults to self if null.
  • moderator: (Optional) Boolean, set to true if a moderator is performing this action.

requestUpgradeToPresenter()

Description

Requests the moderator to upgrade the local user to a presenter.

await samvyoInstance.requestUpgradeToPresenter();

logThisUserOutOfMeeting()

Description

Forces a specific user to leave the meeting (Moderator only).

samvyoInstance.logThisUserOutOfMeeting(peerId);

Parameters

  • peerId: The ID of the user to remove.

setCaptionPreference()

Description

Sets the user's preference for receiving captions.

samvyoInstance.setCaptionPreference(true);

Parameters

  • show: Boolean, true to show captions, false to hide.

handleRoomSettingsGeneral()

Description

Updates the general room settings (e.g., screen sharing permissions).

await samvyoInstance.handleRoomSettingsGeneral({
  allowScreenShare: true,
  noOfScreenShare: 2,
  noOfUpgradeRequests: 10
});

Parameters

  • settings: Object containing general settings.

handleAuthSettings()

Description

Updates the authentication settings for the room.

await samvyoInstance.handleAuthSettings({
  moderatorApproval: true,
  passwordRequired: false
});

Parameters

  • settings: Object containing auth settings.

handleRoomSettingsStage()

Description

Updates the stage mode settings for the room.

await samvyoInstance.handleRoomSettingsStage({
  stageStatus: true,
  stagePeers: [...],
  backStageStatus: false,
  backStagePeers: [...]
});

Parameters

  • stageData: Object containing stage configuration.

handlePresenterSettings()

Description

Updates the permissions for presenters.

await samvyoInstance.handlePresenterSettings({
  allowPresenterPublicChat: true,
  allowPresenterPrivateChat: true,
  allowPresenterRaiseHand: false
});

Parameters

  • presenterSettings: Object containing presenter permissions.

handleParticipantSettings()

Description

Updates the permissions for participants.

await samvyoInstance.handleParticipantSettings({
  allowParticipantPublicChat: true,
  allowParticipantPrivateChat: false,
  allowParticipantRaiseHand: true
});

Parameters

  • participantSettings: Object containing participant permissions.