Skip to content

VideoPlayer

The VideoPlayer component renders a fully self-contained video player inside a Shadow DOM — styles are isolated so they never conflict with the host page.

Terminal window
pnpm add @seeen/player
import { VideoPlayer } from "@seeen/player";
<VideoPlayer
src="https://example.com/video.m3u8"
poster="https://example.com/thumb.jpg"
title="My Video"
/>

Browsers block autoplay with sound. Set both autoplay and muted to satisfy browser policies.

<VideoPlayer src="..." autoplay muted />

Pass a moments array to enable chapter navigation. A scrollable nav strip renders above or below the video (momentsNavPosition), and chapter markers appear on the progress rail.

<VideoPlayer
src="https://example.com/video.m3u8"
moments={[
{ id: "1", title: "Intro", startTimestamp: 0, endTimestamp: 30000, duration: 30000 },
{ id: "2", title: "Chapter 2", startTimestamp: 30000, endTimestamp: 120000, duration: 90000 },
]}
momentsNavPosition="below"
/>
PropTypeRequiredDescription
activeMomentMomentoptionalPre-selects a moment by object, seeking to it on first play. Takes precedence over `activeMomentId`.
activeMomentIdstringoptionalPre-selects a moment by ID, resolved against the `moments` array. Ignored when `activeMoment` is set.
aspectRatiostringoptionalAspect ratio of the video, e.g. `"16:9"` or `"9:16"`. Defaults to `"16:9"`.
autoplaybooleanoptionalStart playing automatically on load. Most browsers require `muted` for autoplay to work.
captionsCaption[]optionalClosed-caption tracks added to the `<video>` element.
ctaTimestampsCtaTimestamp[]optionalTimestamped CTA banners that appear at specific points during playback.
endCardEndCardTypeoptionalEnd card shown when playback finishes. Overrides `sponsor`.
gaMeasurementIdstringoptionalGoogle Analytics 4 measurement ID (e.g. `"G-XXXXXXXXXX"`). Enables play/pause/complete event tracking.
momentEndSplashbooleanoptionalShow a "Watch Again / Resume Video" splash when the `activeMoment` ends. Requires `activeMoment`.
momentNavBehavior"seek" | "moment"optionalWhat clicking a card in `MomentsNav` does. `"moment"` (default) jumps to the moment's start and makes it the active moment, as if it were passed via `activeMomentId`: playback stops at the moment's end and the end splash is shown (when `momentEndSplash` is enabled). `"seek"` only jumps to the start and keeps playing.
momentsMoment[]optionalMoments (chapters) displayed in the `MomentsNav` strip and `MomentsBar` progress indicator.
momentsNavPosition"above" | "below" | "none"optionalWhere the `MomentsNav` strip is rendered relative to the video. Defaults to `"above"`.
mutedbooleanoptionalMute the video. Set alongside `autoplay` to satisfy browser autoplay policies.
overlaysCtaOverlay[]optionalCTA image overlays displayed at fixed positions over the video.
posterstringoptionalURL of the poster image shown before playback begins.
shareSocialMediaIconsSocialMediaIcon[]optionalSocial share icons shown in the share popover.
sponsorSponsoroptionalSponsor shown on the end card when no explicit `endCard` is provided.
srcstringrequiredURL of the video source. HLS (`.m3u8`) and MP4 are supported.
startTimenumberoptionalSeek to this position (in seconds) on first play. Ignored when `activeMoment` is set.
structuredDataRecordoptionalParsed schema.org `VideoObject` — moments are merged in as `hasPart` Clips and injected as a `<script type="application/ld+json">`.
thumbnailStoryboardUrlstringoptionalURL of a WebVTT thumbnail storyboard used for scrubber previews.
titlestringoptionalVideo title shown as an overlay in the top-left corner.
videoIdstringoptionalVideo ID reported on all analytics events.