WirePlayer
A fast, accessible player designed for learning. Adaptive quality, captions, chapters, protection and your brand, from a few lines of code.
WirePlayer is WireVoD’s web player. It plays a lesson from a playback session, adapts quality to every connection, handles content protection automatically and reports playback insights, with an interface built for long-form learning.
Install
Section titled “Install”<video id="lesson" playsinline></video>
<script src="https://cdn.jsdelivr.net/npm/video.js@8.24.1/dist/video.min.js"></script><script src="https://wirevod.online/player/v0.2.0/wireplayer.min.js"></script><script> const player = new WireVoD.WirePlayer("lesson", { source: { session: () => fetch("/api/lessons/1/session").then((r) => r.json()) }, title: "Lecture 1 — Introduction", });</script>The player brings its own styles, and loads its protection module from the same location only when a lesson needs it.
const player = new WireVoD.WirePlayer("lesson", { source: { manifestUrl: session.urls.manifest, telemetryUrl: session.urls.telemetry, entitlementUrl: session.urls.entitlement, // protected lessons only },});source.session is called on every load, including Try again after an error, so it’s the best
place to create a fresh session from your backend. The player fills the width of its container at
the lesson’s aspect ratio.
Options
Section titled “Options”| Option | Default | Description |
|---|---|---|
source | required | { session: () => Promise<session> } or { manifestUrl, telemetryUrl?, entitlementUrl? } |
title | — | Lesson title, shown over the video with the controls |
poster | — | Image shown before playback starts |
startTime | 0 | Position to start from, in seconds; use it to resume where a learner left off |
chapters | — | [{ start, title }] markers on the progress bar; the current chapter is named in the control bar |
captions | — | [{ src, language, label, kind?, default? }] WebVTT files, in addition to any in the stream |
controls | true | false for no interface, or an object to choose controls (below) |
theme | — | Colours, radius and type (see Theming) |
strings | English | Replace any interface text to localise the player |
skipSeconds | 10 | Jump for the skip buttons, J/L and double-tap |
playbackRates | 0.5–2 | Speeds offered in the settings menu |
keyboard | true | Keyboard shortcuts while the player has focus |
hideControlsAfterMs | 2500 | Inactivity before the controls fade during playback |
watermark | — | { text, opacity?, intervalMs? } moving overlay (see Watermark) |
aspectRatio | "16:9" | Shape of the player box, e.g. "4:3" |
autoplay / muted | false | Start playing immediately (browsers usually require muted) |
injectStyles | true | Set false if you host wireplayer.css yourself |
telemetry.enabled | true | Report playback insights |
Choosing controls
Section titled “Choosing controls”Every control is on by default. Turn off what your product doesn’t need:
new WireVoD.WirePlayer("lesson", { source, controls: { seekButtons: false, pip: false, speed: false },});Available keys: play, seekButtons, volume, time, progress, captions, settings,
quality, speed, pip, fullscreen. On narrow screens the player hides the skip buttons and
picture-in-picture automatically; learners double-tap the sides of the video to skip instead.
Theming
Section titled “Theming”Match the player to your product with theme, or change it later with player.setTheme():
new WireVoD.WirePlayer("lesson", { source, theme: { accent: "#0f9d58", radius: "10px", fontFamily: "Poppins, sans-serif" },});Every value is also a CSS custom property, so you can theme from your stylesheet:
.wp { --wp-accent: #0f9d58; --wp-radius: 10px;}| Theme key | CSS property | Default | Controls |
|---|---|---|---|
accent | --wp-accent | #2d5bff | Progress, selections, large play button |
accentForeground | --wp-accent-fg | #ffffff | Icon on the large play button |
foreground | --wp-fg | #ffffff | Icons and text over the video |
surface | --wp-surface | near-black | Menus, tooltips and previews |
radius | --wp-radius | 3px | Buttons, menus and the large play button |
fontFamily | --wp-font | Inter, system UI | All player text |
iconSize | --wp-icon | 22px | Control icons |
progressHeight | --wp-progress | 3px | Progress bar at rest |
scrimOpacity | --wp-scrim | 0.72 | Shade behind the controls |
Captions and chapters
Section titled “Captions and chapters”Captions in the stream appear automatically. Add more with captions; learners switch them with
the CC button, C or the settings menu. When captions first turn on, the player picks
the track that matches the page language.
new WireVoD.WirePlayer("lesson", { source, captions: [ { src: "/captions/lesson-1.en.vtt", language: "en", label: "English" }, { src: "/captions/lesson-1.ar.vtt", language: "ar", label: "العربية" }, ], chapters: [ { start: 0, title: "Introduction" }, { start: 312, title: "Worked example" }, { start: 840, title: "Summary" }, ],});Watermark
Section titled “Watermark”For paid courses, a watermark tying each view to a learner discourages screen recording. Pass text such as the learner’s email; it moves to a new position at an interval and returns if removed from the page.
new WireVoD.WirePlayer("lesson", { source, watermark: { text: learner.email, opacity: 0.3, intervalMs: 15000 },});Combine it with content protection, which prevents downloading the video itself.
Keyboard shortcuts
Section titled “Keyboard shortcuts”Shortcuts work while the player has focus. Press ? in the player to see them.
| Keys | Action |
|---|---|
| K or Space | Play or pause |
| J / L | Back or forward skipSeconds |
| ← / → | Back or forward 5 seconds |
| ↑ / ↓ | Volume up or down |
| M | Mute or unmute |
| C | Captions on or off |
| < / > | Slower or faster |
| 0–9 | Jump to 0–90% of the lesson |
| F | Full screen |
| P | Picture-in-picture |
Every control is reachable with Tab, the progress and volume bars are sliders with arrow keys, and the settings menu works with arrow keys and Escape.
Localisation
Section titled “Localisation”Pass strings to replace any interface text. Unspecified strings stay in English.
new WireVoD.WirePlayer("lesson", { source, strings: { play: "تشغيل", pause: "إيقاف مؤقت", settings: "الإعدادات", quality: "الجودة", speed: "السرعة" },});Methods
Section titled “Methods”| Method | Description |
|---|---|
ready() | Promise that resolves when the lesson is loaded |
play() / pause() | Control playback |
seek(seconds) | Move to a position |
currentTime() / duration() | Position and length in seconds |
setVolume(0–1) / setMuted(bool) | Sound |
setPlaybackRate(rate) | Speed, e.g. 1.5 |
qualities() / setQuality(id) | List qualities; pin one ("720p") or return to "auto" |
captions() / setCaptions(id | null) | List caption tracks; show one or hide captions |
enterFullscreen() / exitFullscreen() | Full screen |
setTheme(theme) | Change theme values at runtime |
reload() | Fetch a fresh session and continue from the same position |
on(event, listener) | Subscribe to an event; returns an unsubscribe function |
destroy() | Send remaining insights and remove the player |
Events
Section titled “Events”| Event | Payload |
|---|---|
ready | — |
play / pause | — |
timeupdate | { currentTime, duration } |
seeked | { currentTime } |
startup | { startupMs }: time from pressing play to the first frame |
stall | { playheadMs }: playback paused to wait for data |
qualitychange | { rendition, bitrateKbps? } |
ratechange | { rate } |
volumechange | { volume, muted } |
captionschange | { language }, or null when captions turn off |
fullscreenchange | { fullscreen } |
error | { code, message? }; see Content protection for drm_* codes |
ended | — |
When playback fails, the player shows a clear message to the learner with a Try again button.
Listen to error to add your own handling:
player.on("timeupdate", ({ currentTime }) => saveProgress(lessonId, currentTime));player.on("error", ({ code }) => reportToSupport(code));