Features

Deep links

Open a page at a moment in a video with

A link like https://example.com/article#ml-t=42,52 can open the page with the player scrolled into view, sitting at 0:42, with 0:42 to 0:52 highlighted on the scrubber and playback pausing when it reaches 0:52. It is opt-in: only a player with deep-link (deepLink in Vue) listens.

This is the link @munsonlabs/splice writes into every clip it makes, so a viewer can go from a clip back to the full video at the same moment. The player does not depend on splice: the URL is the whole contract.

<VideoPlayer src="/video/interview.mp4" deep-link />

One form, in the hash:

https://example.com/article#ml-t=42,52
https://example.com/article#ml-t=42,52&ml-player=interview
PartMeaning
ml-t=42,52The range, in seconds. ml-t=42 seeks without an end; ml-t=1:02,1:10.5 is clock time too
ml-player=<id>Optional. Names the one player the link is for, by its deep-link="<id>"

The keys are namespaced so they never clash with the page's own parameters, and they live in the hash rather than the query so servers, caches and crawlers see one URL per page whatever moment it points at. Hash parts are &-separated, so a single-page app's own hash route can come first: #/article/7&ml-t=42,52. A plain #t= or any ?ml-t= query is not read.

Several players on a page

A link without an id goes to the first deep-link player that asks for it; the others ignore it. To aim at a particular one, give it an id and put that id in the link:

<ml-video-player src="/video/trailer.mp4" deep-link="trailer"></ml-video-player>
<ml-video-player src="/video/interview.mp4" deep-link="interview"></ml-video-player>

<!-- https://example.com/article#ml-t=42,52&ml-player=interview -->

A player with an id still answers a link without one, if it is the first to claim it. Splice writes the id for you: give the clip's origin a player and its links carry &ml-player=<id>.

What happens

  1. The player scrolls to the middle of the viewport (instantly under prefers-reduced-motion).
  2. Once the duration is known, it seeks to the start. It does not start playing: browsers would block unmuted autoplay anyway, and the viewer chose to follow a link, not to have sound start.
  3. The range becomes the player's clip range, as if setClipRange() had been called: published as clipRange on the handle and drawn on the scrubber in --ml-video-range-color (the accent colour by default). The scrubber's aria-valuetext mentions it too.
  4. At the end of the range, deepLinkEnd decides (it is the clip range's end option):
deep-link-endBehaviour
pause (default)Pauses once. Pressing play carries on past the end
loopJumps back to the start, until the viewer seeks more than a second outside it
continuePlays on; the range stays highlighted

A later hashchange (an in-page link to #ml-t=…) is treated as a new link. The remembered playback position is not restored over a deep link.

parseDeepLink(location) is exported, for a page that wants to do something else with the moment (show a banner, pick a playlist item):

import { parseDeepLink } from '@munsonlabs/video-player'

parseDeepLink(location) // { start: 42, end: 52, target: null } or null
munsonlabs · MIT licensed · © 2026