chapters

npm: @playerstack/plugin-chapters

Render a clickable chapter list under (or anywhere around) the player. Active chapter highlights as currentTime advances; clicking a chapter jumps to it.

Quickstart

<player-stack
  src="https://example.com/lesson.mp4"
  data-config='{
    "chapters": {
      "points": [
        { "time": 0,   "label": "Intro" },
        { "time": 60,  "label": "Setup" },
        { "time": 240, "label": "Build the API" },
        { "time": 720, "label": "Deploy" }
      ]
    }
  }'
>
</player-stack>

Config

config.chapters:

FieldTypeDescription
pointsArray<{ time, label }>Sorted automatically. Time in seconds. Required
containerSelectorstring?CSS selector to mount the list outside the player; defaults to inside the player container

Active chapter styling

The currently-active chapter button gets the active class. Style with the accent color:

.playerstack-chapter.active {
  background: var(--ps-accent, #008aff);
  color: #fff;
}

Events

NamePayloadWhen
chapter:jump{ time, label }User clicks a chapter

Use cases