@svta/common-media-library
Version:
A common library for media playback in JavaScript
26 lines • 943 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPsshForKeySystem = getPsshForKeySystem;
const parsePsshList_js_1 = require("./parsePsshList.js");
/**
* Returns the PSSH box associated with the given key system from the concatenated
* list of PSSH boxes in the provided initData.
*
* @param uuid - The desired key system UUID
* @param initData - 'cenc' initialization data. Concatenated list of PSSH boxes.
* @returns The PSSH box ArrayBuffer corresponding to the given key system, or null if not found.
*
* @group DRM
* @beta
*
* @example
* {@includeCode ../../../test/drm/cenc/getPsshForKeySystem.test.ts#example}
*/
function getPsshForKeySystem(uuid, initData) {
if (!initData || !uuid) {
return null;
}
const psshList = (0, parsePsshList_js_1.parsePsshList)(initData);
return psshList[uuid.toLowerCase()] || null;
}
//# sourceMappingURL=getPsshForKeySystem.js.map