Use case: courses

Video hosting for the lessons in your course

Lessons that stream on any connection, play only for the people who enrolled, and tell you who finished them.

Course videos

The problem

A course is a lot of video that only some people should see. Students are on phones and slow connections, so each lesson has to play at a quality their connection can hold. You also want to know who finished a lesson, and captions help every learner.

Doing that yourself means an encoder, storage, a streaming format, a player, and a way to keep non-students out. Platforms that charge by the minute watched make a popular course more expensive the more it is used.

A short code path

Check enrolment, then sign the lesson (Node)
import { Fileboy } from "@cd2/fileboy-node"

const fileboy = Fileboy({
  publicKey: process.env.FILEBOY_PUBLIC_KEY!,
  privateKey: process.env.FILEBOY_PRIVATE_KEY!,
})

app.get("/lessons/:id", async (req, res) => {
  const lesson = await findLesson(req.params.id) // your code
  if (!(await isEnrolled(req.user, lesson.courseId))) return res.sendStatus(403)

  // One signature covers the manifest, segments, poster and captions.
  // Make it last longer than the lesson takes to watch.
  const signedQuery = fileboy.signVideo(lesson.videoId, { expiresIn: 4 * 3600 })

  res.send(`
    <script type="module" src="https://cdn.jsdelivr.net/npm/@cd2/fileboy-player@1.20/dist/fileboy-player.js"></script>
    <fileboy-player video-id="${lesson.videoId}" signed-query="${signedQuery}"></fileboy-player>
  `)
})

Turn on signed URLs for the app first (see the privacy docs). In the page, listen for the player's ended event to mark the lesson complete.

What Fileboy does not do here

  • Live classes. Fileboy is on-demand video only.
  • DRM. A signed URL controls who gets in, not what they do once watching.
  • Quizzes, certificates or progress tracking. Your app keeps those; the player tells you what was watched.

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.