unified-video-framework
Version:
Cross-platform video player framework supporting iOS, Android, Web, Smart TVs (Samsung/LG), Roku, and more
90 lines • 3.25 kB
TypeScript
export interface IDRMProtectionConfig {
enabled: boolean;
blockScreenRecording?: boolean;
blockAudioCapture?: boolean;
blockScreenshots?: boolean;
allowCasting?: boolean;
blockMirroring?: boolean;
licenseServerUrl?: string;
certificateUrl?: string;
licenseHeaders?: Record<string, string>;
widevineSecurityLevel?: 'L1' | 'L3';
onScreenRecordingDetected?: () => void;
onScreenshotAttempted?: () => void;
onMirroringDetected?: () => void;
onCastingStarted?: (deviceName: string, deviceType: CastDeviceType) => void;
onCastingEnded?: () => void;
onLicenseAcquired?: () => void;
onDRMError?: (error: DRMError) => void;
}
export type CastDeviceType = 'chromecast' | 'airplay' | 'smart_tv' | 'dlna' | 'miracast';
export interface DRMError {
code: DRMErrorCode;
message: string;
platform: 'web' | 'android' | 'ios';
recoverable: boolean;
details?: any;
}
export declare enum DRMErrorCode {
LICENSE_REQUEST_FAILED = "LICENSE_REQUEST_FAILED",
LICENSE_SERVER_UNREACHABLE = "LICENSE_SERVER_UNREACHABLE",
INVALID_LICENSE = "INVALID_LICENSE",
DEVICE_NOT_SUPPORTED = "DEVICE_NOT_SUPPORTED",
WIDEVINE_NOT_AVAILABLE = "WIDEVINE_NOT_AVAILABLE",
FAIRPLAY_NOT_AVAILABLE = "FAIRPLAY_NOT_AVAILABLE",
PLAYREADY_NOT_AVAILABLE = "PLAYREADY_NOT_AVAILABLE",
HARDWARE_DRM_NOT_AVAILABLE = "HARDWARE_DRM_NOT_AVAILABLE",
SCREEN_RECORDING_DETECTED = "SCREEN_RECORDING_DETECTED",
MIRRORING_DETECTED = "MIRRORING_DETECTED",
HDMI_OUTPUT_BLOCKED = "HDMI_OUTPUT_BLOCKED"
}
export interface IDRMProtectionStatus {
isProtected: boolean;
drmSystem: 'widevine' | 'fairplay' | 'playready' | 'none';
isScreenRecordingBlocked: boolean;
isAudioCaptureBlocked: boolean;
isScreenshotBlocked: boolean;
isCasting: boolean;
castDevice?: {
name: string;
type: CastDeviceType;
};
screenRecordingDetected: boolean;
mirroringDetected: boolean;
securityLevel?: 'L1' | 'L3';
licenseExpiration?: Date;
}
export interface IDRMProtection {
initialize(config: IDRMProtectionConfig): Promise<void>;
getStatus(): IDRMProtectionStatus;
setEnabled(enabled: boolean): void;
setFeature(feature: keyof IDRMProtectionConfig, enabled: boolean): void;
startCasting(deviceId: string): Promise<void>;
stopCasting(): Promise<void>;
getAvailableCastDevices(): Promise<CastDevice[]>;
renewLicense(): Promise<void>;
dispose(): void;
}
export interface CastDevice {
id: string;
name: string;
type: CastDeviceType;
isAvailable: boolean;
capabilities: {
supportsVideo: boolean;
supportsAudio: boolean;
supportsDRM: boolean;
maxResolution?: string;
};
}
export interface DRMKeySystemConfig {
keySystem: string;
licenseServerUrl: string;
certificateUrl?: string;
headers?: Record<string, string>;
audioRobustness?: string;
videoRobustness?: string;
persistentState?: 'required' | 'optional' | 'not-allowed';
distinctiveIdentifier?: 'required' | 'optional' | 'not-allowed';
}
//# sourceMappingURL=IDRMProtection.d.ts.map