Create a player, load a manifest, listen to events, read metrics, and clean up when done.
Create a player
createPlayer returns a Result<BlindcastPlayer, PlayerError>. The video element must be in the DOM before you call it.
import { createPlayer } from "@blindcast/player"const videoEl = document.getElementById("video") as HTMLVideoElementconst result = createPlayer(videoEl, { keyServerUrl: "https://keys.example.com/keys",})if (!result.ok) { console.error(result.error.code, result.error.message) return}const player = result.value
keyServerUrl must include the /keys path — e.g., https://your-worker.workers.dev/keys, not just the base URL. The player appends /:contentId to this path when fetching keys.
The player fetches the manifest, reads EXT-X-KEY tags to discover the key server URL, fetches the content key, then decrypts each segment as it downloads.
Events
Subscribe to events with player.on(). It returns an unsubscribe function.