unified-video-framework
Version:
Cross-platform video player framework supporting iOS, Android, Web, Smart TVs (Samsung/LG), Roku, and more
39 lines • 1.66 kB
JavaScript
import { BaseDRM } from './BaseDRM.js';
import { KEY_SYSTEMS, DRMErrorCode } from '../types/DRMTypes.js';
import { DRMErrorHandler } from '../utils/DRMErrorHandler.js';
export class PlayReadyDRM extends BaseDRM {
getKeySystem() { return KEY_SYSTEMS.PLAYREADY; }
async initialize() {
try {
const config = [{
initDataTypes: ['cenc'],
videoCapabilities: [{ contentType: 'video/mp4; codecs="avc1.42E01E"' }],
audioCapabilities: [{ contentType: 'audio/mp4; codecs="mp4a.40.2"' }],
persistentState: this.config.persistentState || 'optional',
distinctiveIdentifier: this.config.distinctiveIdentifier || 'optional',
}];
await navigator.requestMediaKeySystemAccess(KEY_SYSTEMS.PLAYREADY, config);
this.log('PlayReady access granted');
return { success: true, drmType: 'playready', keySystem: KEY_SYSTEMS.PLAYREADY };
}
catch (error) {
return {
success: false,
error: DRMErrorHandler.createError(DRMErrorCode.INITIALIZATION_FAILED, `PlayReady init failed: ${error.message}`, error),
};
}
}
getDashProtectionData() {
return {
[KEY_SYSTEMS.PLAYREADY]: {
serverURL: this.config.licenseUrl,
httpRequestHeaders: this.config.headers || {},
withCredentials: this.config.withCredentials || false,
},
};
}
async destroy() {
this.log('PlayReady DRM destroyed');
}
}
//# sourceMappingURL=PlayReadyDRM.js.map