Fly.ioTutorial
Mux, Fly, Wocket and RTMP
Summary
Wocket is a proof-of-concept application for sending live video from a browser to an RTMP server, potentially avoiding a local encoder such as OBS or Ecamm Live. Built with Next.js and a custom WebSocket server, it captures webcam video, renders it onto a canvas, and uses ffmpeg to support streaming to a Mux live stream through an RTMP ingest URL. The post documents local setup with npm, production commands, and deployment to Fly.io via flyctl and a Dockerfile, while noting that ffmpeg must be available on the PATH. The intended integration uses the MediaRecorder API to send video when dataavailable fires. Mux test streams are limited to five minutes, watermarked, and deleted after 24 hours when no credit card is entered, and the author cautions against relying on the demo for important production workloads.
Context
Streaming to RTMP typically requires local encoder software such as OBS or Ecamm Live. Wocket demonstrates how browser-based streaming might work instead, using a Mux live streaming API endpoint rather than streaming directly to platforms such as Twitch, YouTube Live, or Facebook Live.
Approach / What changed
Wocket uses Next.js, a custom WebSocket server, the browser webcam, a canvas element, the MediaRecorder API, and ffmpeg to send video to a Mux RTMP ingest URL. The server can be run locally or built and deployed to Fly.io with flyctl and a Dockerfile.
Takeaways
The browser demo accesses the webcam, renders video onto a canvas, and streams it to a Mux live stream after the user enters a stream key.
Local setup requires ffmpeg to be installed and available in PATH, followed by npm install and npm run dev for development.
Without a credit card, Mux live streams are limited to five minutes, watermarked with the Mux logo, and deleted after 24 hours.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.