Components
Imports
import { VideoPlayer, VideoStage, VideoCard, VideoPlaceholder, HideMarker, VideoPlayerPlugin } from '@munsonlabs/video-player'
import '@munsonlabs/video-player/style'
| Export | Description |
|---|---|
VideoPlayer | The player - one video, full controls, always mounted immediately |
VideoCard | Lazy-mountable single video (poster/placeholder until it enters view or is clicked) |
VideoStage | Sticky, full-width playlist stage, fed by VideoCards via window events |
VideoPlaceholder | The poster/loading placeholder VideoCard uses internally |
HideMarker | Slotless sentinel that tucks a pinned stage away - see below |
VideoPlayerPlugin | app.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
| Component | Use it for |
|---|---|
VideoCard | The common case - one video, lazy by default (poster until clicked) |
VideoPlayer | Same player, always mounted immediately - no lazy placeholder |
VideoStage | A sticky, full-width player that any VideoCard on the page can hand a video to, minifying to a corner pip when scrolled past |
VideoPlaceholder | The 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:
| Event | Direction | Detail |
|---|---|---|
video-select | card → stage | The full VideoEntry (a card's props) plus fromGesture, telling the stage which video to play |
video-toggle | anywhere → 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).