Core Concepts

Components

The four components, what each is for, the window events they talk over, and HideMarker.

Imports

import { VideoPlayer, VideoStage, VideoCard, VideoPlaceholder, HideMarker, VideoPlayerPlugin } from '@munsonlabs/video-player'
import '@munsonlabs/video-player/style'
ExportDescription
VideoPlayerThe player - one video, full controls, always mounted immediately
VideoCardLazy-mountable single video (poster/placeholder until it enters view or is clicked)
VideoStageSticky, full-width playlist stage, fed by VideoCards via window events
VideoPlaceholderThe poster/loading placeholder VideoCard uses internally
HideMarkerSlotless sentinel that tucks a pinned stage away - see below
VideoPlayerPluginapp.use(VideoPlayerPlugin) registers every component globally

The 13 headless controls come from the same entry point. For the <ml-*> custom-element form, see web components.

Which one to use

ComponentUse it for
VideoCardThe common case - one video, lazy by default (poster until clicked)
VideoPlayerSame player, always mounted immediately - no lazy placeholder
VideoStageA sticky, full-width player that any VideoCard on the page can hand a video to, minifying to a corner pip when scrolled past
VideoPlaceholderThe poster/loading placeholder VideoCard uses - exported for reuse

Window events

VideoCard and VideoStage communicate over window events rather than props, which is what lets a card hand its video to a stage anywhere on the page. They're public - dispatch or listen from your own code:

EventDirectionDetail
video-selectcard → stageThe full VideoEntry (a card's props) plus fromGesture, telling the stage which video to play
video-toggleanywhere → stage{ src } - play/pause that video if it is already the one on the stage, counting as a user gesture; a no-op for any other src, so use video-select to put a video on the stage

Hiding the pinned stage

When a VideoStage (or a pinned player) sits in a corner it can cover content lower on the page. Place a HideMarker just before that content - the box slides mostly off-screen while the marker is in view, and slides back when it isn't:

<VideoStage pin="bottom-right" :playlist="videos" />

<!-- ...page content... -->

<HideMarker />
<Footer />

It renders one unstyled, full-width <div> with min-height: 1px and no slot, so it triggers as the page scrolls past that exact line rather than staying active for a whole section - place it precisely. There's no prop linking it to a stage; only one stage exists per page. The visible sliver is --ml-video-stage-tuck (default 32px).

munsonlabs · MIT licensed · © 2026