Scrolling & viewport
A player that leaves the viewport auto-pauses by default. Two props change that:
| Prop | Entering view | Leaving view |
|---|---|---|
| (neither) | Nothing | Auto-pauses |
playInView | Auto-plays, muted | Auto-pauses |
pin | Nothing | Pins to a corner and keeps playing |
playInView suits a feed you scroll through; pin suits a single video you want to keep watching while reading on.
playInView - feeds
Auto-plays once at least half the player is visible (see playInViewRatio below), auto-pauses once it isn't, and plays again each time it scrolls back in. A video the viewer paused, or one that has ended, stays paused until they play it again - see playInView for the muting and lazy-placeholder details.
<VideoCard src="..." play-in-view />
<ml-video-card src="..." play-in-view></ml-video-card>
To wait for more of the player first, set playInViewRatio (0.5 by default). 1 waits until all of it is on screen; a player too big to fit, such as a tall portrait video on a short screen, plays once it fills as much of the screen as it can.
<VideoCard src="..." play-in-view :play-in-view-ratio="1" />
Loading player…
The pattern it exists for is a TikTok-style vertical feed - each slide a bare VideoPlayer with a HUD built from the headless controls:
<VideoPlayer v-bind="video" :controls="false" :muted="globalMuted" play-in-view @state-change="onStateChange" />
<Buffering :player="playerRef" />
<MuteButton :player="playerRef" />
<PlayButton :player="playerRef" />
<Scrubber :player="playerRef" />
pin - mini-player
Swaps auto-pause for YouTube-style pinning: once it scrolls out of view while playing, it pins to that corner and keeps going, with a dismiss button. Like a mini-player, pausing it while pinned doesn't dismiss it - it stays until scrolled back into view or dismissed.
<VideoCard src="..." muted pin="bottom-left" />
<ml-video-card src="..." muted pin="bottom-left"></ml-video-card>
Loading player…
bottom-right, bottom-left, top-right and top-left are supported. A pinned box can cover content lower on the page - HideMarker tucks it away while a given section is in view, and --ml-video-radius sets its corner radius.
VideoStage does the same thing for a whole playlist, minifying to a corner pip rather than pinning the card itself.