vide Svelte Themes

Vide

Modular, headless video player. Ads, streaming, DRM as plugins.

Vide

Modular video player library. Use only what you need.

Documentation · Getting Started · Demo

<video src="video.mp4"></video>
import { createPlayer } from "@videts/vide";
import { vast } from "@videts/vide/vast";
import { hls } from "@videts/vide/hls";

const player = createPlayer(document.querySelector("video")!);
player.use(hls());
player.use(vast({ tagUrl: "https://example.com/vast.xml" }));

Explicit setup. No data attributes. No class scanning. No side effects. Web standards first — if the browser can do it, we don't reinvent it.

Install

npm install @videts/vide

Package is published as @videts/vide on npm. The project name is Vide.

Quick Start

<video src="video.mp4"></video>
import { createPlayer } from "@videts/vide";
// import type { PlayerEventMap } from "@videts/vide";

const player = createPlayer(document.querySelector("video")!);

// HTMLVideoElement-compatible — play, pause, src, currentTime, … all proxied
player.play();
// player.pause();
// player.src = "video.mp4";
// player.currentTime = 30;

// player.el — direct access to the underlying <video> element
// player.el.requestPictureInPicture();

// player.on() — typed custom events (statechange, ad:start, error, …)
player.on("statechange", ({ from, to }) => console.log(`${from} → ${to}`));
// player.on("volumechange", (e) => console.log(e.target));  // native events too

// addEventListener() delegates directly to the <video> element
// player.addEventListener("canplay", () => { ... });

Quick Start with UI

<div id="player-container">
  <video src="video.mp4"></video>
</div>
import { createPlayer } from "@videts/vide";
import { ui } from "@videts/vide/ui";
import "@videts/vide/ui/theme.css";

const player = createPlayer(document.querySelector("video")!);
player.use(ui({ container: document.getElementById("player-container")! }));

See the Getting Started guide for more.

Plugins

Plugins are explicit opt-in. Import only what you need.

Plugin What gzip
@videts/vide Core player 2.8 KB
@videts/vide/vast VAST 4.2 ads 6.6 KB
@videts/vide/vmap VMAP scheduling 7.1 KB
@videts/vide/hls HLS streaming 1.3 KB
@videts/vide/dash DASH streaming 1.3 KB
@videts/vide/drm DRM (Widevine + FairPlay) 1.6 KB
@videts/vide/ssai SSAI (server-side ads) 1.9 KB
@videts/vide/omid Open Measurement 1.7 KB
@videts/vide/simid Interactive ads 2.4 KB
@videts/vide/vpaid VPAID 2.0 ads 1.8 KB
@videts/vide/ima Google IMA SDK bridge 3.3 KB
@videts/vide/ui Headless UI 5.5 KB
@videts/vide/ui/theme.css Default theme 4.4 KB

HLS and DASH plugins require hls.js and dashjs as peer dependencies.

See the plugin documentation for usage examples and configuration options.

Documentation

License

MIT

Top categories

Loading Svelte Themes