Published · Updated
What recording in the browser involves
Bug reports, feedback on work, support questions and walkthroughs are all quicker as a short video than as text. Browsers can record the screen and camera themselves, so it looks like a small feature. The browser APIs are the easy part; the rest is what takes the time.
getDisplayMediafor the screen, window or tab,getUserMediafor the camera and microphone, and mixing a tab's sound with the microphone.MediaRecorderrecords different formats in different browsers: WebM in Chrome, Edge and Firefox, MP4 in Safari. You have to pick one each browser supports.- Permission prompts that differ in every browser, and a macOS setting that blocks the browser entirely. Most support questions about recorders are these.
- A countdown, pause and resume, a time limit, a preview before upload, and device pickers with a level meter so people know their microphone works.
- WebM files from
MediaRecorderhave no length in their header and a variable frame rate, so most video tools show the wrong duration and can't seek them until they are fixed up. - Uploading a file of tens or hundreds of megabytes reliably, then encoding it for streaming, hosting it and giving back a link.
Video APIs such as Mux and Cloudflare Stream host and stream the result, but leave the recorder to you. Fileboy's <fileboy-recorder> element is the recorder, and the recording becomes an ordinary Fileboy video.
1. Add the recorder to a page
Load the script and put the element where the recorder should be. It needs your app's public key, and the page's origin in your app's allowed origins, as for any upload from the browser.
<script type="module" src="https://cdn.jsdelivr.net/npm/@cd2/fileboy-recorder@0.5/dist/fileboy-recorder.js"></script>
<fileboy-recorder public-key="YOUR_PUBLIC_KEY" mode="screen" max-duration="300" label="bug-report"></fileboy-recorder>The person presses Start recording, picks what to share, sees a three-second countdown and records, with pause, restart and cancel. max-duration stops it at five minutes. It uploads while they record, so fileboy:link gives you the watch link as soon as recording starts, and stopping only sends the last few seconds. mode="camera" records the camera instead.
2. Keep the video's id
When the upload finishes the element fires fileboy:recorded with the video's id and its links. Save the id with your own record (the bug report, the piece of work). The watch link works straight away, and usually plays a few seconds after the upload finishes, from the recording itself while its other qualities are made.
document.querySelector("fileboy-recorder").addEventListener("fileboy:recorded", async e => {
const { videoId, watchUrl } = e.detail
await fetch("/api/bug-reports", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ videoId, watchUrl }),
})
})To know when it can be played, listen for the video.playable webhook on your server (video.ready follows once every quality is made), or play it with <fileboy-player video-id="...">, which waits for it. A WebM recording from Chrome, Edge or Firefox plays straight away wherever the browser plays WebM; older Safari and some iOS versions wait for the other qualities.
3. In React
FileboyRecorder in @cd2/fileboy-react wraps the element, with callbacks for its events. It takes the public key from your FileboyProvider and is safe with server rendering.
import "@cd2/fileboy-recorder"
import { FileboyProvider, FileboyRecorder } from "@cd2/fileboy-react"
export function ReportABug() {
return (
<FileboyProvider publicKey="YOUR_PUBLIC_KEY">
<FileboyRecorder
maxDuration={300}
label="bug-report"
onRecorded={video => saveReport(video.videoId)}
/>
</FileboyProvider>
)
}4. Add the camera, drawing and clicks
mode="screen camera" records the screen with the person's camera in a bubble they can drag, resize and move with the arrow keys while recording. drawing gives them a pen and highlighter on the recorder's live preview, and click-highlights shows their clicks as ripples when they share the tab the recorder is in (Chrome and Edge). All three are drawn into the video itself.
<fileboy-recorder
public-key="YOUR_PUBLIC_KEY"
mode="screen camera"
bubble-position="bottom-right"
drawing
click-highlights
></fileboy-recorder>A web page can't draw over other windows or apps, so drawing happens on the recorder's own preview and lands in the video in the same place. Plain screen recordings skip all of this and cost nothing extra.
What browsers can record
- Chrome and Edge on a computer: a screen, window or tab, and a tab's sound.
- Firefox and Safari on a computer: a screen or window, with the microphone but no tab or system sound.
- Phones and tablets: the camera only. No mobile browser lets a web page capture the screen; the recorder says so rather than failing.
When a browser blocks the camera, microphone or screen, the recorder shows what happened and how to allow it in that browser, including the macOS privacy setting. Every error also comes to your page as a fileboy:error event with a code.
What happens to the recording
It uploads in 5 MB parts while it records, in order, each retried until it gets through (the recorder says it is catching up when the connection drops), held to your plan's limits like any upload. Until the last part is in, the link shows "This recording is still uploading". It is marked as a recording, so it is processed ahead of the app's bulk uploads (a 10-minute head start, for up to 3 of an app's recordings every 10 minutes, so other uploads never wait long; between apps the queue takes turns). Seconds after the upload completes, Fileboy copies the recording's streams into a file a browser can play and seek in (nothing is re-encoded), so the link plays it straight away. It then encodes it to 240p to 1080p for HLS and DASH with a poster and seek previews, the same as any video, and the player moves to those. Captions, privacy settings, comments and analytics all work on it.
Each recording is also kept in the browser (IndexedDB) until Fileboy has it. If the tab crashes or closes part way, the recorder offers Resume upload the next time it loads, which finishes the same video. Private browsing windows may not keep anything, so there it can't be recovered.
Checked against the current libraries in November 2026. Found something that no longer works? Tell us.