Room integrations without React
Share YouTube videos and Miro boards from an app built on @whereby.com/core, without React, or start them from Node.
This guide covers room integrations for apps that use @whereby.com/core directly: Vue, Svelte, Angular, plain JavaScript, or a Node process. If you use React, follow Sharing YouTube and Miro instead. The hooks there do most of what this page does by hand.
Read the How it works section of the React guide first. The model is the same. Each integration runs in an iframe that Whereby serves from the integration's origin. Your page talks to it with postMessage. The room connection state is the source of truth.
Without React you need three pieces:
A share menu, built from
getState().roomIntegrations.embeddable.A picker frame.
@whereby.com/corebuilds the URL, and@whereby.com/browser-sdkhas a listener you can use without React.A content frame for each running session. Core has no helper for this, so you implement the content frame protocol yourself. The code below is under 100 lines.
The examples assume you've joined a room as in the Core SDK quick start:
import { WherebyClient } from "@whereby.com/core";
const client = new WherebyClient();
const roomConnection = client.getRoomConnection();
roomConnection.initialize({ roomUrl, localMediaOptions: { audio: true, video: true } });
await roomConnection.joinRoom();Watch the room integration state
Room integration state lives in getState().roomIntegrations (see RoomConnectionClient: Room Integrations). There's no dedicated subscription, so use subscribe and skip updates where roomIntegrations hasn't changed. subscribe doesn't call you straight away, so render once yourself as well:
The list of integrations loads shortly after you join. embeddable is empty until roomIntegrations.hasFetched is true.
Pick something to share
The picker is a page on the integration's origin. Load it with roomIntegrationPickerUrl and wait for one answer with subscribeToRoomIntegrationPicker:
subscribeToRoomIntegrationPicker checks both the origin and the source window of every message, then reports the first submitted, cancelled or error outcome and stops listening. getSource is a function because contentWindow is null until the frame attaches.
Don't add a sandbox attribute. Some providers open a window to sign the user in, and a sandbox blocks it without an error.
Or share a link directly
roomIntegrationContent builds the content from a YouTube link or a Miro embed link, with no picker:
startRoomIntegration doesn't change local state. The session shows up in roomIntegrations.running when the server broadcasts it, for you and everyone else at about the same time.
Show running integrations
Each running session needs an iframe that speaks the content frame protocol. mountIntegrationFrame creates one, handles its messages, and returns update and destroy functions:
Then keep one frame per running session. Mount new sessions, update existing ones, and destroy the ones that stopped:
running already only contains sessions for where you are, the main room or your breakout group. Late joiners get the running sessions when they join, so syncIntegrationFrames mounts them on the first state update.
Optional messages
mountIntegrationFrame leaves out the messages you don't strictly need. Add them to the switch if you want them:
whereby:contentReadytells you the content has loaded, so you can hide a spinner.whereby:audioOverridewith{ enabled: false }asks you to turn the local microphone off, and{ enabled: null }drops that request.whereby:setVolumeandwhereby:getVolumecontrol the volume on this device. YouTube takes0to1.
The iframe protocol reference has every payload.
Don't move the iframe
Moving an iframe to another parent, or removing and re-adding it, reloads it. The frame posts whereby:frameReady again and the code above resends the full props, so nothing breaks, but a YouTube video restarts its player. Mount each frame once and change its size and position with CSS when your layout changes.
Stop sharing
canStop is true for the participant who started the session and for hosts. For anyone else, stopRoomIntegration sets the not_allowed_to_stop error and sends nothing.
Start from Node
roomIntegrationContent doesn't need a browser, so a Node process in the room can start a share. An Assistant can queue up a video when a session starts, for example. The Assistant SDK installs @whereby.com/core, so you can import from both:
The Assistant is the presenter for that session, so it can stop it later. Everyone in the room still needs a browser to see the content. The Assistant only starts and stops sessions, it doesn't render anything.
Check roomConnection.getState().roomIntegrations.error after starting, in case the server refuses the request.
Limitations
The limitations in the React guide apply here too. Only YouTube and Miro render in SDK apps, Miro needs an embed link, and there's no core helper for the content frame.
Last updated
Was this helpful?

