> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fastpix.com/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fastpix.com/docs/_mcp/server.

# In-video quiz for web

> Pause a FastPix video at set times to ask the viewer a question and block the controls until they answer, built from the page around an unmodified fastpix-player.

In-video quizzes pause a FastPix video at set times, ask the viewer a question, and block the controls until they answer. Use them for knowledge checks in training, onboarding, and course content, where you want to confirm the viewer understood a section before they move on.

This recipe builds the whole experience from the page, around an unmodified FastPix web player (`fastpix-player`). Nothing in the player source changes.

\


## How it works

The quiz is a plain HTML element placed inside the player and assigned to one of the player's named slots. Because it composes inside the player, it stays visible in fullscreen. The page drives everything through the player's public API and the media events it already forwards:

* It watches `timeupdate` to detect when playback reaches a checkpoint, then calls `pause()` to stop the video and show the question.
* It calls `play()` to resume once every question in the checkpoint is answered.
* It listens for `ended` to show the final score.

Questions are grouped into checkpoints. A checkpoint is a timestamp that holds one or more questions, asked in sequence before playback continues. Seeking is safe: if a viewer scrubs past a checkpoint they have not completed, it opens immediately instead of being skipped.

\


## Before you begin

You need:

* A FastPix playback ID for a video. See [Play your videos](/docs/video-on-demand/play-your-videos).
* The FastPix web player web component (`fastpix-player`), loaded from the CDN as shown in the code.

\


## Customize the quiz

Edit the `CHECKPOINTS` array to set your own timestamps, questions, options, correct answers, and explanations. Set `at` to the time in seconds where each checkpoint fires, and list one or more questions per checkpoint. Replace `your-playback-id` on the `fastpix-player` element with your own playback ID.

\


## Full example

The complete page is below. Each step explains one part of the code.

#### In-video quiz for web

#### Web Player

#### Page head

#### Styling the player and its slot

#### Styling the quiz overlay

#### The quiz markup in a named slot

#### Getting the player element

#### Defining checkpoints and their questions

#### Flattening the questions

#### Caching the overlay elements

#### Tracking quiz state

#### Rendering the progress dots

#### Finding the next question in a checkpoint

#### Opening a question

#### Recording an answer

#### Advancing or resuming

#### Firing checkpoints as the video plays

#### Showing the results

#### Gating the keyboard

#### Initial render