PlayerSource¶
PlayerSource describes the loaded media. This is the only part that cannot be invented: type, URL, file, DRM rights, and identifiers must come from the product or backend.
| Field | Required | Default | Explanation | Use when | Avoid if |
|---|---|---|---|---|---|
type |
Yes | None | Media type: local-file, url, hls, or dash. |
hls for .m3u8, dash for .mpd, url for a direct file. |
Do not use url for an adaptive manifest when ABR/DRM is expected. |
url |
Depends on type | None | URL loaded by the engine. | CDN sources, app assets, HLS/DASH manifests. | Empty, temporary, or signed URL used as durable identifier. |
file |
Yes for local-file |
None | Browser File provided by the user. |
Local preview or user import. | Server mode or remote source. |
contentId |
No but recommended | undefined |
Stable identifier for progress, metadata, subtitles, and offline. | Any app with resume, catalog, episodes, or telemetry. | Signed URL or volatile value. |
live |
No | undefined |
Marks a live stream. | TV, live event, low latency. | VOD with unknown duration. |
drm |
No | undefined |
Key systems, license server, headers, robustness, persistent license. | Rights delivered with each asset. | Permanent tokens hardcoded in the browser. |
abr |
No | No cap | Adaptive bitrate hints: maxHeight, maxBandwidth. |
Mobile, data saver, older TV, enterprise profile. | Presenting it as an absolute guarantee. |
profile |
No | Default engine | Local profile: default, tv, mobile, low-latency. |
Adjust one media item in a playlist. | Contradicting a global profile without a rule. |
sidecar |
No | undefined |
metadataUrl, subtitles, chapters, VTT thumbnails. |
Local subtitles, chapters, artwork, timeline previews. | Cross-origin sidecars without compatible CORS. |
offlineEligible |
No | false by intention |
Allows the source to be downloaded offline. | Content contractually downloadable. | DRM or fragile license without verified rights. |
DASH Example¶
source: {
type: "dash",
url: "https://cdn.example.com/movie.mpd",
contentId: "movie-42",
abr: { maxHeight: 1080 },
drm: {
keySystems: {
"com.widevine.alpha": {
licenseServerUrl: "https://license.example.com/widevine"
}
}
}
}