Discourse Video Stream 🎥

AI-generated summary

This thread introduces the Discourse Video Stream plugin, a community project by Falco that integrates Cloudflare Stream for high-quality video uploads and live streaming. The plugin supports adaptive bitrate streaming via Shaka Player, resumable uploads for large files using tus-js-client, and secure server-side proxying of API credentials. Key features include composer integration for direct uploads, custom BBCode embedding ([video-stream id="..."]), and playback controls for resolution and speed.

An update announced in post 2 adds support for live streaming with RTMPS broadcasting. Users can generate stream credentials directly from the composer to use with software like OBS or Streamlabs. Live streams are automatically recorded for later playback, utilizing the same adaptive player interface as pre-recorded content.

Discussion regarding alternative providers highlights interest in supporting Bunny.net. ccdw noted similarities between Bunny and Cloudflare’s offerings, suggesting it would be feasible to modify endpoints. While Falco confirmed that adding Bunny support would be straightforward, they stated they are not actively working on the plugin and lack a Bunny account for testing, recommending users fork the repository if needed. Initial user feedback from Ray_Crick reported a minor audio issue during first upload that was resolved upon retry.

Discourse Video Stream adds seamless Cloudflare Stream integration for uploading and embedding high-quality, long-form video content and live streaming in your Discourse site.

Overview

This plugin provides a complete workflow for handling large video files with adaptive bitrate streaming, allowing your users to upload videos directly from the composer and play them back with automatic quality adjustment based on their network conditions. It also supports creating live streams with RTMPS broadcasting.

Key Features

  • :clapper_board: Composer Integration: Optional toolbar button for direct video uploads from the composer
  • :outbox_tray: Automatic Upload Interception: Videos exceeding a configurable size threshold are automatically uploaded to Cloudflare Stream instead of local storage
  • :high_voltage: Resumable Uploads: Built on tus-js-client for reliable uploads of files well beyond 200 MB with automatic resume on connection issues
  • :locked: Secure Proxy: Server-side endpoint generates short-lived Cloudflare Stream upload URLs, keeping your API credentials safe
  • :satellite_antenna: Live Streaming: Create live streams with RTMPS broadcasting directly from the composer
  • :movie_camera: Custom BBCode: Simple [video-stream id="..."] syntax for embedding videos
  • :television: Adaptive Streaming: Shaka Player integration with DASH manifests for smooth playback across varying network speeds
  • :gear: Playback Controls: Built-in UI for resolution selection and playback speed control

Installation

Add the plugin to your app.yml:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/xfalcox/discourse-video-stream.git

Then rebuild your container:

./launcher rebuild app

Configuration

Navigate to Admin → Settings → Video streaming and configure:

Setting Description Default
video_stream_enabled Enable the video streaming plugin false
video_stream_account_id Your Cloudflare account identifier -
video_stream_api_token API token with Stream:Edit permissions -
video_stream_customer_subdomain Your Cloudflare Stream domain (e.g., customer-xxxxx.cloudflarestream.com) -
video_stream_allowed_extensions Comma-separated list of allowed video formats mp4,webm,mov
video_stream_max_file_size Maximum file size in MB (1-2000) 500
video_stream_intercept_native_uploads Automatically intercept large video uploads true
video_stream_intercept_threshold_mb Size threshold in MB for automatic interception (1-2000) 10
video_stream_enable_live_streams Enable live streaming feature false

Getting Cloudflare Stream Credentials

  1. Log into your Cloudflare dashboard
  2. Navigate to Stream under your account
  3. Copy your Account ID from the Stream overview
  4. Create an API token with Stream:Edit permissions
  5. Note your Customer subdomain from the Stream settings

Usage

Once configured, users have two ways to upload videos:

Automatic Interception

When a user drags and drops or selects a video file that exceeds the video_stream_intercept_threshold_mb setting, the plugin automatically handles it via Cloudflare Stream instead of local storage. You need to allow video file extensions on the allowed extension settings for this to work.

Manual Upload

Users can click the composer toolbar’s pop-up menu (:plus:) and select the video upload option to explicitly upload to Cloudflare Stream.

Both methods insert a [video-stream id=“video_id”] BBCode tag that renders as an adaptive streaming player with resolution and speed controls.

Live Streaming

When video_stream_enable_live_streams is enabled, users can create live streams:

  1. Click the composer toolbar’s pop-up menu (:plus:) and select “Create live stream”
  2. A modal generates RTMPS credentials via Cloudflare Stream API
  3. Copy the RTMPS URL and stream key using the convenient copy buttons
  4. Use the credentials with OBS, Streamlabs, or any RTMPS-compatible broadcasting software
  5. Click “Insert embed” to add the [video-stream id=“…”] BBCode to your post
  6. Start broadcasting immediately

Live Stream Features:

  • Automatic recording enabled by default (streams are saved for later playback)
  • Same adaptive player works for both live and recorded content
  • Users see live content while streaming, then can watch the recording afterward
  • Secure credential handling with warning messages

Why Cloudflare Stream?

We have support for doing the same using AWS in code, and with Mux in GitHub - discourse/discourse-video · GitHub, so a cheaper alternative sounded like a good idea.

Requirements

  • Active Cloudflare account with Stream enabled

Source & Support

Screenshots

Demo

Visit my test site and upload some videos

https://discourse-on-a-pi5.falco.dev/t/test-video-upload-plugin/20?u=falco


Note: This is not an official plugin.

19 Likes

Update: Live Streaming Support Now Available! :satellite_antenna:

The plugin now supports live streaming with RTMPS broadcasting!

What’s new:

  • Create live streams directly from the composer toolbar menu
  • Get RTMPS credentials instantly via Cloudflare Stream API
  • Stream with OBS, Streamlabs, or any RTMPS-compatible software
  • Automatic recording enabled - streams are saved for playback after broadcasting ends
  • Same [video-stream id="..."] BBCode and adaptive player for both live and recorded content

How to enable:
Set video_stream_enable_live_streams to true in Admin → Settings → Video streaming

See the updated OP for full details on the live streaming workflow.

14 Likes

Hey, Very nice. I work in Film and TV and we are building a media centric experience.

We use Bunny. How easy would it be for us to modify endpoints in the plugin to allow different CDNs/Streaming platforms?

5 Likes

It appears that Bunny offering is awfully similar to the Cloudflare one, it should be easy to add support for it.

4 Likes

Thanks Falco. Will look into it.

1 Like

Great plugin and thank you. For some reason on first upload video was working but audio wasn’t working in the community, but video and audio worked in Cloudflare. Deleted, and tried again and now all is good.

1 Like

Hi. Is there any chance we’ll see bunny added to the plugin? Their prices appear much better than cloudflare’s. Sorry if this was too old, thanks.

I’m not actively working on this, so I wouldn’t hold my breath for it.

It should be a pretty straight forward to fork and make it use Bunny instead, but since I don’t have an account there testing would be a hassle.