Guide

Add a Loom-style recorder to your app

A record button, a camera bubble and a link the moment recording starts, in React or plain HTML, with the videos kept in your own app.

Video guide · in this guide

  • What a Loom-style recorder is made of
  • 1. Install and register the element
  • 2. A record button with a link
  • 3. Camera bubble, drawing and click highlights
  • 4. Decide who may record

Published

What a Loom-style recorder is made of

The pattern that tools like Loom made familiar has four parts: a record button, a camera bubble over the screen, a link you can paste the moment you start, and a page where people watch. Your own app can have all four, with the videos kept in your own account.

Fileboy's <fileboy-recorder> element is the first three, and every recording becomes an ordinary Fileboy video, so the watch page, the player, captions, privacy settings and webhooks are already there. The screen recording API guide covers the basics and the browser APIs behind them. This one builds the whole flow in React, and shows the pieces that make it feel like a product.

1. Install and register the element

npm install @cd2/fileboy-recorder @cd2/fileboy-react

Version 0.18 or later of @cd2/fileboy-react has the onLink, onRecoverable, liveUpload and recovery props used below. Importing @cd2/fileboy-recorder registers the element and is safe during server rendering. Add the page's origin to your app's allowed origins, as for any upload from the browser, and use your public key.

Without React, load the script and use the element directly, as in the recorder docs. Everything below has an attribute and an event of the same name.

2. A record button with a link

The recorder uploads while the person records, so the video's link exists the moment recording starts and stopping only sends the last few seconds. onLink gives you that link early, and onRecorded fires when the upload is complete.

RecordButton.tsx
import "@cd2/fileboy-recorder" // once, on the client: registers the element
import { useState } from "react"
import { FileboyProvider, FileboyRecorder } from "@cd2/fileboy-react"

export function RecordUpdate({ ticketId }: { ticketId: string }) {
  const [link, setLink] = useState<string | null>(null)

  return (
    <FileboyProvider publicKey="YOUR_PUBLIC_KEY">
      <FileboyRecorder
        mode="screen camera"
        maxDuration={600}
        label="ticket-update"
        metadata={{ ticketId }}
        onLink={recording => setLink(recording ? recording.watchUrl : null)}
        onRecorded={video => saveRecording(ticketId, video.videoId)}
        onError={error => console.warn(error.code, error.message)}
      />
      {link && (
        <p>
          Share this: <a href={link}>{link}</a>
        </p>
      )}
    </FileboyProvider>
  )
}

saveRecording is yours: store the videoId with the ticket, the lesson or the bug report it belongs to. onLink can be called with null if the live upload was refused part way and the link withdrawn. The recording then uploads when the person stops, and gets a new link. The element also shows the link itself with a Copy link button while recording, so your own text is optional.

The watch page says "This recording is still uploading" until the upload completes, then plays. Seconds after that, Fileboy makes a playable copy of the recording (its streams copied into a file a browser can seek, nothing re-encoded), and moves on to the full set of qualities after.

3. Camera bubble, drawing and click highlights

mode="screen camera" draws the camera over the screen in a bubble the person can drag, resize and move with the arrow keys while they record. drawing adds a pen and highlighter on the recorder's own preview, and clickHighlights shows a ripple at each click when the person shares the tab the recorder is in (Chrome and Edge). All of it is recorded into the video.

<FileboyRecorder
  mode="screen camera"
  bubblePosition="bottom-right"
  bubbleShape="circle"
  bubbleSize={25}
  drawing
  drawingFade={5}
  clickHighlights
  onBubbleChange={layout => localStorage.setItem("bubble", JSON.stringify(layout))}
/>

onBubbleChange gets { x, y, size, shape } after each change, so the next recording can start where the person left it. A web page can't draw over other windows or apps, so drawing happens on the preview and lands in the video in the same place.

4. Decide who may record

With a public key, anyone who can open the page can record, held to your allowed origins and your plan's limits. That suits a feedback box. For a tool where only signed-in people should record, give the recorder an upload token, which your server issues, so you decide who may record and for how long. See the uploader docs for making the token endpoint.

<FileboyRecorder
  uploadToken={() =>
    fetch("/api/fileboy-token", { method: "POST" })
      .then(r => r.json())
      .then(r => r.token)
  }
  recoveryScope={user.id}
  metadata={{ userId: user.id }}
/>

recoveryScope matters on a browser that several people share: see the next section. metadata is saved on the video, so you can find a person's recordings later with the management API.

5. Survive a crash or a closed tab

Every chunk is kept in the browser's IndexedDB until Fileboy has the whole recording. If the tab crashes or is closed part way, the next recorder to load offers Resume upload and Discard, and resuming finishes the same video, so a link already shared still works. A recorder removed from the page while recording, such as a route change in a single-page app, stops the take and keeps it the same way.

<FileboyRecorder
  onRecoverable={recordings => {
    // [{ id, name, duration, bytes, recordedAt, videoId }]
    console.log(recordings.length + " recording(s) did not finish uploading")
  }}
/>
  • Recordings are kept per API and key. Set recoveryScope to the signed-in user's id wherever people share a browser profile, so nobody is offered another person's recording.
  • A browser without IndexedDB, or a private window that clears it, keeps nothing. Recording and uploading work as usual.
  • Storage is bounded: at most two recordings are kept, up to a week, and never more than 1 GiB for one. recovery={false} keeps none.

6. Show the recording

The videoId you saved plays in the Fileboy player, and every recording has a watch page at the watchUrl. To know when a recording plays and when every quality is ready, listen for the video.playable and video.ready webhooks on your server.

<script type="module" src="https://cdn.jsdelivr.net/npm/@cd2/fileboy-player@1.20/dist/fileboy-player.js"></script>

<fileboy-player video-id="VIDEO_ID"></fileboy-player>

A WebM recording (Chrome, Edge, Firefox) doesn't play from its quick copy in older Safari and some iOS versions. Those viewers see it processing until its qualities are ready, which is usually a short wait.

7. Make it look like yours

The element takes your colours and fonts through CSS custom properties, and exposes its parts to ::part(). Every control is a native button or select, focus moves to each step's main button, state changes are announced to screen readers, and animations stop under prefers-reduced-motion.

fileboy-recorder {
  --fbr-accent: #0f766e;
  --fbr-on-accent: #ffffff;
  --fbr-record: #dc2626;
  --fbr-radius: 8px;
  --fbr-font: "Inter", sans-serif;
}

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, because no mobile browser lets a web page capture the screen. The recorder says so rather than failing.

Recording needs a secure page (https, or localhost). The recorder is about 28 KB gzipped, with no dependencies. For a recorder outside your own pages, there is also a Chrome extension.

Checked against the current libraries in November 2026. Found something that no longer works? Tell us.

Still choosing a tool?

Fileboy is small on purpose. This comparison says where it fits and where another option is the better call.

Get a key and run this code

Create a free app, copy your keys into the example and run it. The free plan needs no card.