sources

Package: @playerstack/plugin-sources (source), not published to npm yet

Auto-detects the source type from a single src URL, validates it, and lets the core element pick the right inner media element (native <video> for MP4/WebM, <youtube-video>, <vimeo-video>, or <hls-video>). Paste any URL — it just works.

Quickstart

<player-stack src="https://youtu.be/dQw4w9WgXcQ"></player-stack>
<player-stack src="https://www.youtube.com/watch?v=dQw4w9WgXcQ"></player-stack>
<player-stack src="https://vimeo.com/123456789"></player-stack>
<player-stack src="https://example.com/video.mp4"></player-stack>
<player-stack src="https://example.com/playlist.m3u8"></player-stack>

Supported formats

Format URL patterns
YouTube youtu.be/ID, youtube.com/watch?v=ID, /embed/ID, /shorts/ID, /v/ID, m.youtube.com/..., youtube-nocookie.com/...
Vimeo vimeo.com/ID, vimeo.com/ID/HASH (private), player.vimeo.com/video/ID
MP4 any https://...*.mp4
HLS any https://...*.m3u8
WebM any https://...*.webm
DASH any https://...*.mpd

Extension matching is case-insensitive. Non-https schemes are rejected. Unknown formats produce a clear error at init time.

Config

This plugin reads config.src, validates it, and sets it on the inner media element. No additional config slice.

HLS starting quality

By default hls.js picks the first quality level itself. config.hls passes options to hls.js, which loads these streams; the object is read once, when the <hls-video> element is created.

<player-stack
  src="https://example.com/playlist.m3u8"
  data-config='{ "hls": { "abrEwmaDefaultEstimate": 1200000 } }'
></player-stack>

Safari and every iOS browser (Apple WebKit) play HLS natively: without config.hls the player uses a native <video> there and never downloads playerstack-hls.js (about 166 KB gzip). Setting config.hls (even {}) keeps hls.js on those browsers too, so the options apply everywhere. Chrome, Edge and Firefox always use hls.js.

Programmatic resolver

The parser is exported standalone:

import { resolveSource } from "@playerstack/plugin-sources";

const result = resolveSource("https://youtu.be/dQw4w9WgXcQ");
// { type: "youtube", id: "dQw4w9WgXcQ" }

Useful for server-side rendering where you want to pre-resolve the source type.