LogoLogo
WherebyStatusCommunity
  • 📹Whereby 101
    • Create Your Video Experience
      • Get started in 3 steps
      • Embedding Whereby in a web app
        • Using Whereby's Web Component & Pre-built UI
          • Script Tags
          • With Low Code
            • Embedding in Squarespace or Wordpress
            • No code video conferencing in Bubble
        • Using Whereby's Browser SDK with React Hooks for a fully custom UI
      • Embedding Whereby in a mobile app
        • Embedding Whereby in iOS
          • Using Whereby's Native iOS SDK
        • Embedding Whereby in Android
          • Using Whereby's Native SDK
        • Using Flutter
        • Using React Native
      • Github SDK Examples
      • Meeting scheduling with Cronofy
    • Generating Room URLs
      • Name prefixes
      • Using “Create a room”
      • Using Postman
    • Customize Your Video Experience
      • During room creation
      • Using Attributes/URL Params
      • Global preferences
      • Branding elements
      • Dial-In
      • File sharing
      • Breakout Groups with Embedded
      • Waiting Rooms
    • User roles & Meeting Permissions
    • FAQ
      • Accessibility
      • Whereby Words
      • Firewall & Security
      • HIPAA compliant setup
      • Allowed Domains & Localhost
      • Whereby Embedded Feature Comparison
  • 🔍Meeting Content & Quality
    • Recording
      • Cloud Recording
      • Local Recording
    • Transcribing
      • Session Transcription
      • Recording Transcription
    • Live Captions
    • Session summaries
    • Live streaming RTMP
    • Quality Insights
      • Real-time troubleshooting
      • Using the Insights dashboard
      • Improving call quality
      • Tracking room events with Webhooks
  • 🤷End User
    • End User Support Guides
      • Supported Browsers & Devices
      • Screen Sharing Setup & Usage
      • Using Breakout Groups
      • Troubleshooting & Basics
  • 🚚Developer Guides
    • Quickly deploy Whereby to your domain
    • Tracking Customer Usage
    • Migrating from Twilio
      • Twilio JS SDK Quick Migration
      • Twilio JS SDK Direct Migration
  • 🖥️Reference
    • REST API Reference
      • /meetings
      • /insights
      • /recordings
      • /transcriptions
      • /summaries
      • /rooms
    • Web Component Reference
    • React Hooks Reference
      • Quick Start
        • Getting started with the Browser SDK
      • Guides & Tutorials
        • Migrate from version 2.x to 3
        • Grid logic
        • Custom Video Tiles with React
        • Usage with Next.js
        • How to customize the toolbar
      • API Reference
        • WherebyProvider
        • VideoView
        • VideoGrid
        • useLocalMedia
        • useRoomConnection
      • Types
    • React Native Reference
      • Quick Start
      • WherebyEmbed
    • Webhooks Reference
Powered by GitBook
On this page
  • Installation
  • Listening to events
  • Sending commands

Was this helpful?

Edit on GitHub
  1. Whereby 101
  2. Create Your Video Experience
  3. Embedding Whereby in a web app

Using Whereby's Web Component & Pre-built UI

Last updated 1 year ago

Was this helpful?

The Web Component offering in our SDK allows you to leverage the thoughtfully designed, pre-built Whereby interface and user experience we've developed over the last 10+ years.

Below are a few examples of how you can use some of the client events and commands that can be sent to a room. We have information on how to get started and install, but for a full document about events, attributes, and commands you can view our Web Component Reference documentation.

Installation

When using React or a bundler like Webpack, Rollup, Parcel, etc. you can install the Whereby Browser SDK in your project using npm:

npm install @whereby.com/browser-sdk

You can then import it as follows:

import "@whereby.com/browser-sdk/embed"

And embed your room using our <whereby-embed> web component:

<whereby-embed room="https://subdomain.whereby.com/your_room?roomKey=3fe345a"></whereby-embed>

You can use a hostRoomUrl instead of the roomUrl, if you want to give the user

const MyComponent = ({ roomUrl }) => {
    return <whereby-embed room={roomUrl} />
}

export default MyComponent

You can use a hostRoomUrl instead of the roomUrl, if you want to give the user

If you aren't using a bundler or a library containing a bundler you can access the component code directly from our CDN using a in your site

Listening to events

You can on the <whereby-embed> component. Here are a few examples how the events might be useful, but there are lots of creative ways these might be useful! Let us know in an email or our discord how you've implemented these.

leave

When a user leaves the room, you can redirect them to a page of your choosing

const whereby = document.querySelector("whereby-embed");

whereby.addEventListener("leave", () => location.href = "https://whereby.com")

participantupdate

const whereby = document.querySelector("whereby-embed");
let participantCount = 0

function logEvent(event) {
    participantCount = event.detail.count
  }
  
whereby.addEventListener("participantupdate", logEvent, { once: true }) // Adding the once option prevents repetitive refreshes

if(participantCount <= 200){
  whereby.room = "https://subdomain.whereby.com/roomname-123"
} else {
  whereby.room = "https://subdomain.whereby.com/roomname-123?roomKey=xyz..."
}

A few other ideas:

  • Display an in app greeting banner whenever there is a new participant_join event

  • Display an in app message directing users to certain support documentation whenever they accidentally deny_device_permission

  • Make a log for support or success teams if a user frequently experiences connection_status_change errors so they can proactively reach out and investigate connection issues

Sending commands

For this feature to work, you must add the origin of your application to the "Allowed domains" section on your Whereby dashboard. If not present, the following methods will not function.

const whereby = document.querySelector("whereby-embed");
<whereby-embed floatSelf background=off displayName="Rick Astley" room="https://subdomain.whereby.com/roomname-123-xyz?bottomToolbar=off"></whereby-embed>

<button onclick="whereby.toggleCamera()">CAMERA</button>
<button onclick="whereby.toggleMicrophone()">MIC</button>   
<button onclick="whereby.toggleScreenshare()">SCREENSHARE</button>
<button onclick="whereby.toggleChat()">CHAT</button>

Keep track of the number of participants in a room. Once a room has reached its capacity (200 participants), you can swap the room source URL to a for additional capacity.

The <whereby-embed> web component exposes a set of your application can invoke to perform actions in the room.

For example, using a you can hide the bottom toolbar and create your own buttons for taking actions in the room:

📹
Web Component Reference
simple Script tag
viewerRoomUrl
host privileges
host privileges
URL parameter
listen for events
methods