@streamiq/plugin-drm
v1.1.0
Published
DRM plugin for Streamq DASH playback (Shaka license server wiring).
Maintainers
Readme
@streamiq/plugin-drm
Optional DRM registration for MPEG-DASH playback via Shaka (@streamiq/dash). Maps Widevine / FairPlay / PlayReady license endpoints to Shaka drm.servers without putting DRM logic in @streamiq/core.
Stable
1.0.0. Peers:@streamiq/core,@streamiq/dash.
Install
npm install @streamiq/core @streamiq/dash @streamiq/plugin-drmUsage
import { Player } from '@streamiq/core';
import { createDashPlaybackAdapter } from '@streamiq/dash';
import { DRMPlugin } from '@streamiq/plugin-drm';
const video = document.querySelector('video')!;
const player = new Player({
target: video,
plugins: [
new DRMPlugin({
widevine: { licenseUrl: 'https://your-license-proxy/widevine' },
fairplay: { licenseUrl: 'https://your-license-proxy/fairplay' },
playready: { licenseUrl: 'https://your-license-proxy/playready' },
}),
],
createPlaybackAdapter: createDashPlaybackAdapter,
});
await player.load({ src: 'https://example.com/encrypted.mpd', type: 'dash' });Features
| Feature | Detail |
|---------|--------|
| Multi-DRM | Register Widevine, FairPlay, PlayReady in one plugin |
| Shaka mapping | Pure buildShakaDrmServers(config) → Shaka drm.servers |
| No secrets in SDK | You supply license URLs; never log tokens or signed URLs |
| DASH only | Progressive / HLS-only playback ignores DRM registration |
Public API
| Export | Description |
|--------|-------------|
| DRMPlugin | Plugin class |
| DRM_PLUGIN_NAME | '@streamiq/plugin-drm' |
| DrmPluginConfig | Plugin configuration type |
| WidevineDrmConfig, FairplayDrmConfig, PlayreadyDrmConfig | Per-OEM config |
| buildShakaDrmConfig(config) | Rich Shaka DRM config for DASH adapter integration |
| buildShakaDrmServers(config) | Pure helper for Shaka config |
| SHAKA_WIDEVINE_KEY_SYSTEM | Key system id constant |
| SHAKA_FAIRPLAY_KEY_SYSTEM | Key system id constant |
| SHAKA_PLAYREADY_KEY_SYSTEM | Key system id constant |
Configuration
new DRMPlugin({
widevine: {
licenseUrl: 'https://license.example.com/widevine',
headers: {
Authorization: 'Bearer short-lived-token',
},
withCredentials: true,
// optional serverCertificate / prepareLicenseRequest / parseLicenseResponse
},
fairplay: {
licenseUrl: 'https://license.example.com/fairplay',
},
});Shaka selects the appropriate key system for the manifest.
License URLs must use https, except for http://localhost style development setups.
Security
- Never log license URLs, auth tokens, or signed query strings
- Keep license proxy on your backend — client receives short-lived URLs only
- This plugin performs no logging of sensitive data
Requirements
- Encrypted DASH via
@streamiq/dash(Shaka Player) - Browser with required CDM for target DRM system
Bundle size
| Budget | Limit | |--------|-------| | Full plugin | 4 kB gzipped (Shaka external) |
License
MIT
