Use case: user clips

Let your users upload clips and play them to others

Let people upload a clip, play it back to others in every quality, and keep comments and reactions in your hands.

User-generated clips

The problem

Accepting a video from a stranger means large files, formats you did not expect, and a wait while it is made playable. Then every viewer needs a version that suits their screen and connection.

You also need to know when a clip is ready, and to keep control of what is said about it.

A short code path

Upload a clip, then wait for the webhook
// In the browser: send the clip with your public key
async function uploadClip(file: File, title: string) {
  const form = new FormData()
  form.append("file", file)
  form.append("data", JSON.stringify({ name: title }))

  const response = await fetch("https://api.fileboy.io/videos/upload", {
    method: "POST",
    headers: { Authorization: "public YOUR_PUBLIC_KEY" },
    body: form,
  })
  const video = await response.json()
  return video.id // send it to your server to link to the person who uploaded it
}

// On your server: publish the clip when it is ready (Express)
import { verifyWebhook } from "@cd2/fileboy-node"

app.post("/fileboy-webhook", express.raw({ type: "application/json" }), async (req, res) => {
  const event = verifyWebhook(req.body, req.headers, process.env.FILEBOY_WEBHOOK_SECRET!)
  if (event.type === "video.ready") await publishClip(event.resource.id) // your code
  res.sendStatus(200)
})

Whoever uploads with a public key chooses the name and metadata, so set anything you rely on from your server afterwards.

What Fileboy does not do here

  • Moderating video for you. Fileboy has no video moderation pipeline, so review clips yourself before you make them public.
  • A native mobile SDK. The upload is plain HTTP, so an app can call it, but there is no iOS or Android library.
  • Live streaming. Fileboy is on-demand video only.

Try it with your own files

Create a free app, paste your public key into the code on this page and upload something of yours. The free plan needs no card.