Embedding a video conference widget with the Digital Samba SDK
You can embed a video conference widget in your website or app with the Digital Samba SDK in four steps: create a room via the REST API, add the @digitalsamba/embedded-sdk package to your page, load the room into an iframe the SDK manages for you, and wire your own buttons to SDK methods for branding, devices, screen sharing and recording. Your users join meetings without leaving your site, and the interface runs in your colours.
In this guide, we'll build that up step by step, with working code for each part: creating the room, initialising the SDK via npm or a CDN, changing the branding, and controlling the call from your own interface.
Table of contents
- Benefits of embedding a video conference widget
- Getting started with the Digital Samba SDK
- Create a room
- Integrate the Digital Samba SDK into your application
- Changing branding options
- Controlling meetings with SDK methods
- Frequently asked questions
- Conclusion
Benefits of embedding a video conference widget
Why embed a video conference widget instead of sending people to an external meeting link? A few practical reasons:
- No context switching: participants join calls on your own pages, with no downloads, extra tabs or third-party branding. A "Start consultation" button can connect a visitor to your team in one click.
- Your brand, not ours: the SDK lets you set the palette mode and the primary, toolbar and background colours, so the room looks like part of your product rather than a bolted-on tool.
- Your own controls: every important call action – muting, video, screen sharing, recording, leaving – has an SDK method, so you can build your own toolbar or participants panel and keep the workflow inside your interface.
- One room, many sessions: rooms are created once through the API and reused, and team-wide defaults mean new rooms start configured the way you want.
Getting started with the Digital Samba SDK
Prerequisites
Before embedding the widget, make sure you have:
- A Digital Samba account (sign up here)
- A browser with WebRTC support – every current desktop and mobile browser qualifies
- Basic knowledge of JavaScript or TypeScript
With that in place, the integration has four parts: create a room, add the SDK to your application, brand the interface, and connect your own controls. Let's take them in order.
1. Create a room
Every call happens in a room, and the room URL is what the SDK loads when it starts a session. There are two ways to create one: over the REST API (which we'll use here) or in the dashboard.
a. Make a POST request to the /rooms endpoint
curl --request POST \
--header "Content-Type: application/json" \
--url https://api.digitalsamba.com/api/v1/rooms \
--user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY \
--data '{"privacy": "public"}'
You'll find your TEAM_ID and DEVELOPER_KEY in the Team section of the Digital Samba dashboard. The developer key grants full control of your team, so run this request from your backend only – never in the browser.
b. Read the room URL from the API response
The response contains the room's id and an auto-generated friendly_url:
{
"id": "c39d7c40-7ff7-4faa-b06f-698a639a9523",
"friendly_url": "l5zIyafmlEFMPKA",
"privacy": "public"
}
Together with your team name, that gives you the full meeting URL the SDK will load:
https://YOUR_TEAM.digitalsamba.com/l5zIyafmlEFMPKA
c. Customising the room URL
By default the friendly_url is a random string, but you can pass your own, easy-to-remember name when creating the room:
curl --request POST \
--header "Content-Type: application/json" \
--url https://api.digitalsamba.com/api/v1/rooms \
--user YOUR_TEAM_ID:YOUR_DEVELOPER_KEY \
--data '{"privacy": "public", "friendly_url": "weekly-standup"}'
The meeting URL then becomes:
https://YOUR_TEAM.digitalsamba.com/weekly-standup
Rooms have far more options than privacy and the URL – roles, end-to-end encryption, feature toggles and branding can all be set at creation or changed later. We cover that side in detail in our guide to configuring Digital Samba rooms with the API and SDK.
2. Integrate the Digital Samba SDK into your application
The SDK is distributed as the npm package @digitalsamba/embedded-sdk, written in TypeScript. For production integrations, install it with your package manager:
npm install @digitalsamba/embedded-sdk
For quick prototyping, you can load it with a script tag from the unpkg CDN instead:
<script crossorigin src="https://unpkg.com/@digitalsamba/embedded-sdk"></script>
To initialise the SDK, import the package and create a DigitalSambaEmbedded control with your configuration options – at minimum the room URL, and optionally a root element the iframe should be created in:
import DigitalSambaEmbedded from '@digitalsamba/embedded-sdk';
const sambaFrame = DigitalSambaEmbedded.createControl({
url: 'https://YOUR_TEAM.digitalsamba.com/weekly-standup',
root: document.querySelector('#meeting-container')
});
This creates a sambaFrame instance, which renders the call interface. To join the call, call the load() method on the instance:
sambaFrame.load();
That opens the call interface in the iframe and connects you to the room. If you skip the root option, the SDK appends the frame to the page body, and it can also attach to an iframe you've already placed yourself – the DigitalSambaEmbedded class documentation lists every initialisation combination.
3. Changing branding options
The changeBrandingOptions() method aligns the widget's design with your brand while the call runs. It accepts an object with these properties:
- paletteMode: switches between the 'light' and 'dark' themes; the choice mainly determines the background colour of the panels.
- primaryColor: the primary theme colour, used for main actions and highlighting, as a hex colour code.
- toolbarColor: the toolbar's background colour, as a hex colour code.
- roomBackgroundColor: the backdrop colour of the room, as a hex colour code.
Here are some examples:
// Switch the interface to the dark palette
sambaFrame.changeBrandingOptions({ paletteMode: 'dark' });
// Match the primary colour to your brand
sambaFrame.changeBrandingOptions({ primaryColor: '#0000ff' });
// Set the toolbar and room background colours
sambaFrame.changeBrandingOptions({
toolbarColor: '#00ff00',
roomBackgroundColor: '#ff0000'
});
Persistent branding – the room's stored colours and logo settings – lives on the room itself and is set over the API or in the dashboard, so the two approaches complement each other: room fields for the standing look, changeBrandingOptions() for changes on the fly.
4. Controlling meetings with SDK methods
The SDK exposes a method for every common call action, which is what makes a custom toolbar possible. Here are the controls you'll reach for most often.
4.1 Mute and unmute the microphone
Muting keeps background noise out of the call; unmuting lets the user speak. Both methods act on the local user's microphone:
// Mute the local user's microphone sambaFrame.disableAudio(); // Unmute it again sambaFrame.enableAudio();
4.2 Start and stop video
The same pattern applies to the camera – useful for privacy and for saving bandwidth on weaker connections:
// Turn the local user's camera on sambaFrame.enableVideo(); // Turn it off sambaFrame.disableVideo();
4.3 Screen sharing
startScreenshare() opens the browser's screen-picker, where the user chooses to share the entire screen or a specific window or tab, and stopScreenshare() ends the share. Separately, moderators can grant or revoke the screen-share permission for a specific participant with allowScreenshare() and disallowScreenshare(), which take that participant's id:
// Start and stop sharing the local user's screen sambaFrame.startScreenshare(); sambaFrame.stopScreenshare(); // Grant and revoke screen-share permission for another participant sambaFrame.allowScreenshare(participantId); sambaFrame.disallowScreenshare(participantId);
4.4 Record the meeting
Recordings run in the cloud: once stopped and processed, the mp4 file is available in your team dashboard. Note that startRecording() is ignored if recordings are not enabled for the room, or if a recording is already in progress:
// Start a cloud recording of the meeting sambaFrame.startRecording(); // Stop it sambaFrame.stopRecording();
4.5 Virtual background
configureVirtualBackground() enables or changes the local user's virtual background. You specify one of blur ('balanced' or 'strong'), image (a predefined background such as 'office', 'beach' or 'forest'), imageUrl (your own image) or videoUrl plus thumbnailUrl for a video background. The optional enforce parameter, when true, stops the user changing the background themselves once inside the room:
// Blur the background and lock the choice
sambaFrame.configureVirtualBackground({ blur: 'balanced', enforce: true });
// Use your own branded background image
sambaFrame.configureVirtualBackground({ imageUrl: 'https://example.com/background.jpg' });
// Turn the virtual background off
sambaFrame.disableVirtualBackground();
There's also enableVirtualBackground(), which takes the same options, and you can supply a whole custom collection of backgrounds for users to pick from at initialisation – see the virtual background documentation.
4.6 View participants
listUsers() returns an array of the people currently in the room, each with their id, name, role and whether they are the local or a remote user:
const users = sambaFrame.listUsers();
console.log('There are', users.length, 'users inside the room:');
console.log(users);
If you're building a live participants panel, subscribe to the usersUpdated event instead of polling – it hands you an up-to-date array whenever someone joins or leaves. Our guide to selecting and switching participants in a Digital Samba video call goes deeper into participant control.
4.7 Leave the call
leaveSession() disconnects the local user only – the meeting carries on for everyone else. Wire it to your own hang-up button:
sambaFrame.leaveSession();
4.8 End the call
endSession() ends the meeting for every participant. By default a confirmation popup is shown first; pass false to skip it and remove everyone immediately:
// End the call with a confirmation modal sambaFrame.endSession(); // End it immediately, without confirmation sambaFrame.endSession(false);
For the full catalogue of methods, events and properties – including webhooks if your backend needs to react to room and session events – see the SDK documentation and our how-to guides.
Frequently asked questions
Do I need a backend to embed the video conference widget?
You need one for room creation, because the POST /rooms request is authenticated with your developer key, which must never reach the browser. The embedding itself is pure client-side JavaScript: the SDK loads an existing room URL, and tokens for private rooms are issued from your backend.
Can I use the SDK without npm?
Yes. For prototyping you can load it with a script tag from the unpkg CDN and call DigitalSambaEmbedded.createControl() directly. For production, the npm package with a bundler is the recommended route, and TypeScript definitions ship with it.
Where do meeting recordings end up?
Recordings started with startRecording() run in the cloud, and the finished mp4 appears in your team dashboard once the recording is stopped and processed. The call is ignored if recordings are not enabled for the room.
What's the difference between leaveSession() and endSession()?
leaveSession() disconnects only the local user, while the meeting continues for everyone else. endSession() ends the call for all participants, with a confirmation popup by default that you can skip by passing false.
Can I stop users changing their virtual background?
Yes. Pass enforce: true to configureVirtualBackground() and the background you set – a blur, an image or a video – stays locked for that user while they are in the room.
Conclusion
Digital Samba Embedded takes the heavy lifting out of adding video chat to your website or app: one API request creates the room, a few lines of JavaScript embed it, and the SDK's methods let your own interface drive the call. From there you can go further – custom participant panels, branding changes mid-call, recordings for later review – without building any video infrastructure yourself.
The free developer tier includes 10,000 participation minutes per month, which is plenty to build and test your integration end to end. Sign up to get started.
Share this
You May Also Like
These Related Stories

Easy Steps to Integrate Video Call on Your Website

How to Dynamically Modify Roles Using the Digital Samba SDK

