Skip to main content
This guide walks you through installing the CometChat Calls SDK and initializing it in your web application.

Install the SDK

Install the CometChat Calls SDK using npm or yarn:
npm install @cometchat/calls-sdk-javascript

Import the SDK

Import the CometChatCalls class in your JavaScript or TypeScript file:
import { CometChatCalls } from "@cometchat/calls-sdk-javascript";

Initialize CometChat Calls

The init() method initializes the SDK with your app credentials. Call this method once when your application starts.

CallAppSettings

The initialization requires a configuration object with the following properties:
ParameterTypeRequiredDescription
appIdStringYesYour CometChat App ID
regionStringYesYour app region (us, eu, or in)
const appId = "APP_ID"; // Replace with your App ID
const region = "REGION"; // Replace with your Region ("us", "eu", or "in")

const callAppSettings = {
  appId: appId,
  region: region,
};

const result = await CometChatCalls.init(callAppSettings);

if (result.success) {
  console.log("CometChat Calls SDK initialized successfully");
} else {
  console.error("CometChat Calls SDK initialization failed:", result.error);
}
The init() method returns an object with:
PropertyTypeDescription
successBooleantrue if initialization succeeded
errorObject | nullError details if initialization failed

Browser Requirements

The Calls SDK requires a modern browser with WebRTC support:
BrowserMinimum Version
Chrome72+
Firefox68+
Safari12.1+
Edge79+
HTTPS is required for camera and microphone access in production. Localhost is exempt from this requirement during development.

Permissions

The browser will prompt users for camera and microphone permissions when joining a call. Ensure your application handles permission denials gracefully.
// Check if permissions are granted
async function checkMediaPermissions() {
  try {
    const stream = await navigator.mediaDevices.getUserMedia({ 
      video: true, 
      audio: true 
    });
    stream.getTracks().forEach(track => track.stop());
    return true;
  } catch (error) {
    console.error("Media permissions denied:", error);
    return false;
  }
}