Skip to main content
RapidDev - Software Development Agency
bubble-tutorial

How would you approach setting up live streaming capabilities in Bubble.io: Step

Add live streaming to your Bubble app by integrating Mux or Amazon IVS via the API Connector. This tutorial covers creating live streams through API calls, embedding the video player in an HTML element, handling stream start and stop events via webhooks, and tracking viewer counts in real-time for a complete streaming experience.

What you'll learn

  • How to set up Mux for live streaming and get API credentials
  • How to create and manage live streams via the API Connector
  • How to embed a video player in your Bubble page
  • How to track viewer counts and stream state changes via webhooks
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner5 min read30-35 minGrowth plan+ (streaming APIs require server-side calls)March 2026RapidDev Engineering Team
TL;DR

Add live streaming to your Bubble app by integrating Mux or Amazon IVS via the API Connector. This tutorial covers creating live streams through API calls, embedding the video player in an HTML element, handling stream start and stop events via webhooks, and tracking viewer counts in real-time for a complete streaming experience.

Overview: Setting Up Live Streaming in Bubble

Bubble does not process video natively, so live streaming requires an external video service. This tutorial integrates Mux with Bubble via the API Connector to create streams, embed players, and track viewers. Whether building a webinar platform, live shopping feature, or community broadcasts, this guide provides the foundation.

Prerequisites

  • A Bubble account on the Growth plan or higher
  • A Mux account (mux.com) with API credentials
  • Basic understanding of Bubble's API Connector
  • Familiarity with HTML elements for embedding content

Step-by-step guide

1

Set up your Mux account and get API credentials

Sign up at mux.com and go to Settings → API Access Tokens. Create a new token with Mux Video permissions. Copy the Token ID and Token Secret — these are your API credentials for Bubble. Mux offers a free tier for development.

Expected result: A Mux account with API credentials ready for Bubble integration.

2

Configure the API Connector for Mux

In Bubble, go to Plugins → API Connector → Add another API named Mux. Set Authentication to HTTP Basic Auth with Token ID as username and Token Secret as password. Create an API call named Create Live Stream: POST to https://api.mux.com/video/v1/live-streams. Set the body to JSON with playback_policy set to public. Initialize the call. The response includes a stream_key and playback_ids.

API Connector payload
1POST https://api.mux.com/video/v1/live-streams
2
3Body:
4{
5 "playback_policy": ["public"],
6 "new_asset_settings": {"playback_policy": ["public"]}
7}
8
9Response includes:
10 stream_key: "live_xxx..."
11 playback_ids: [{"id": "xxx", "policy": "public"}]

Expected result: The API Connector creates live streams on Mux with proper authentication.

3

Embed the video player on your page

Create a Data Type called LiveStream with fields: Mux_ID (text), Stream_Key (text), Playback_ID (text), Status (text), Host (User), and Viewer_Count (number). On your viewing page, add an HTML element with the Mux Player web component. Load the player script in Settings → SEO → header scripts. Set the playback-id attribute dynamically using the LiveStream record's Playback_ID.

HTML element
1<script src="https://cdn.jsdelivr.net/npm/@mux/mux-player"></script>
2<mux-player
3 stream-type="live"
4 playback-id="PLAYBACK_ID_HERE"
5 autoplay
6 muted
7></mux-player>

Expected result: A video player displays on the page and plays the live stream when active.

4

Handle stream state changes via webhooks

In Mux dashboard → Webhooks, add an endpoint pointing to your Bubble backend workflow URL. In Bubble, create a backend workflow called mux-webhook. Handle events: video.live_stream.active sets Status to active and records Started_At, video.live_stream.idle sets Status to idle. Update the LiveStream record based on the Mux stream ID in the webhook payload.

Expected result: Stream state changes update automatically in your database via Mux webhooks.

5

Track viewer count and add stream controls

Create a Get Live Stream API call (GET /video/v1/live-streams/{id}) to fetch current viewer count. Schedule a backend workflow that polls every 30 seconds while the stream is active. Display Viewer_Count on the stream page. Add a Go Live button for hosts that creates a new LiveStream and shows the stream key for OBS. Add an End Stream button that calls the Mux disable endpoint. For advanced streaming with chat, donations, and multi-camera, RapidDev can help architect a complete platform.

Expected result: Viewer counts update in near-real-time and hosts can start and end streams from the app.

Complete working example

Workflow summary
1LIVE STREAMING WORKFLOW SUMMARY
2==================================
3
4DATA TYPE: LiveStream
5 Mux_ID, Stream_Key, Playback_ID, Status, Host (User),
6 Viewer_Count (number), Started_At (date)
7
8API CALLS:
9 Create Live Stream: POST /video/v1/live-streams
10 Get Live Stream: GET /video/v1/live-streams/{id}
11
12WORKFLOW: Go Live clicked
13 1. Call Create Live Stream
14 2. Create LiveStream record with response data
15 3. Show Stream_Key to host (for OBS)
16
17BACKEND: mux-webhook
18 video.live_stream.active Status = active
19 video.live_stream.idle Status = idle
20
21BACKEND: poll-viewer-count (every 30s while active)
22 Call Get Live Stream Update Viewer_Count
23
24PAGE: watch
25 HTML element: <mux-player> with dynamic Playback_ID
26 Viewer count display + status indicator

Common mistakes

Why it's a problem: Exposing the stream key to viewers

How to avoid: Use Privacy Rules to restrict Stream_Key field to only the Host user.

Why it's a problem: Not handling stream end events

How to avoid: Handle Mux webhook idle events and show a Stream ended message.

Why it's a problem: Polling viewer counts too frequently

How to avoid: Poll every 30-60 seconds — sufficient for most viewer count displays.

Best practices

  • Use Mux webhooks for state changes instead of polling
  • Restrict stream keys to host users via Privacy Rules
  • Use the Mux Player web component for best playback experience
  • Show loading states while the stream connects
  • Store recordings for replay functionality
  • Rate-limit polling to 30-60 second intervals

Still stuck?

Copy one of these prompts to get a personalized, step-by-step explanation.

ChatGPT Prompt

I want to add live streaming to my Bubble.io app using Mux. Help me set up API Connector calls for creating streams, embedding the player, and handling webhooks.

Bubble Prompt

Create a Go Live button that calls Mux to create a live stream, saves the stream key and playback ID, and shows the key to the host for broadcasting.

Frequently asked questions

How much does Mux cost?

Mux charges per minute of video ingested and delivered. Free tier covers development. Production costs roughly $0.01-0.02 per viewer per minute.

What streaming software does the host need?

OBS Studio (free), Streamlabs, or any RTMP-compatible tool. Enter the Mux ingest URL and stream key.

Can I add live chat alongside the stream?

Yes. Build chat with a Messages Data Type and Repeating Group. Bubble's real-time updates work well for this.

What is the latency?

Standard Mux streams have 10-20 second latency. Low-latency mode reduces to 3-5 seconds.

Can I record streams for replay?

Yes. Mux automatically creates recordings when streams end. Display them on a recordings page.

Can RapidDev build a streaming platform?

Yes. RapidDev can architect streaming platforms with chat, donations, viewer analytics, and recording management.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.