import type { NMVideoPlayer } from '../../index.js'; import type { VideoPlaylistItem } from '../../types.js'; import { Plugin } from '@nomercy-entertainment/nomercy-player-core'; /** Options for the video {@link DrmPlugin}. */ export interface DrmOptions { /** EME key system identifier — `'com.widevine.alpha' | 'com.apple.fps' | 'com.microsoft.playready'` etc. */ keySystem: string; /** License server URL. */ licenseUrl: string; /** Service certificate for FairPlay (optional for Widevine/PlayReady). */ certificate?: ArrayBuffer | string; /** Optional request signer for license calls (HMAC etc.). */ customSignRequest?: (request: Request) => Request | Promise; /** Optional license request body transformer. */ transformLicenseRequest?: (challenge: ArrayBuffer) => ArrayBuffer | Promise; /** Optional license response body transformer. */ transformLicenseResponse?: (response: ArrayBuffer) => ArrayBuffer | Promise; /** Output protection requirements. */ hdcpRequired?: 'type-0' | 'type-1' | 'none'; } /** Events emitted by the video {@link DrmPlugin}. */ export interface DrmEvents { 'key:error': { sessionId: string; error: Error; }; 'unsupported': { reason: string; }; } /** * EME DRM coordination plugin. Handles license acquisition for Widevine / * FairPlay / PlayReady and routes HDCP / output-protection signals. * * Stub-but-loadable: registration + lifecycle is real, license fetch routing * (with optional `customSignRequest`) is real, but the actual EME key-system * handshake is gated behind `requestMediaKeySystemAccess` so JSDOM and other * environments without EME stay quiet. When the API is missing, an * `unsupported` event is emitted and the plugin exits cleanly. */ export declare class DrmPlugin extends Plugin, DrmOptions, DrmEvents> { static readonly id: string; static readonly version: string; static readonly description: string; private supported; /** Probes EME availability and wires the `current` listener to trigger the key-system handshake. */ use(): void; /** Resets EME support state on teardown. */ dispose(): void; /** * Fetch a license blob from the configured license server. Wraps the * request through `customSignRequest` when provided so callers can apply * HMAC / proprietary signing without subclassing. */ fetchLicense(challenge: ArrayBuffer): Promise; /** Returns the backend's `mediaKeys` if EME is supported and bound. */ mediaKeys(): MediaKeys | null; private tryHandshake; } /** Plugin alias for the video {@link DrmPlugin}. Pass to `addPlugin(drmPlugin)`. */ export declare const drmPlugin: typeof DrmPlugin;