@svta/common-media-library
Version:
A common library for media playback in JavaScript
28 lines • 1.26 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLegacyKeySystemAccess = getLegacyKeySystemAccess;
const createMediaKeySystemConfiguration_js_1 = require("./createMediaKeySystemConfiguration.js");
const getSupportedKeySystemConfiguration_js_1 = require("./getSupportedKeySystemConfiguration.js");
/**
* Fallback method to get key system access using legacy MediaKeys.isTypeSupported().
*
* @param requests - An array of key system access requests.
* @returns A KeySystemAccess object if successful, or null if no system is supported.
*
* @group DRM
* @beta
*/
function getLegacyKeySystemAccess(requests) {
for (const { keySystem, configurations } of requests) {
const supportedConfig = (0, getSupportedKeySystemConfiguration_js_1.getSupportedKeySystemConfiguration)(keySystem, configurations);
if (supportedConfig) {
const configuration = (0, createMediaKeySystemConfiguration_js_1.createMediaKeySystemConfiguration)(supportedConfig.supportedAudio, supportedConfig.supportedVideo);
return {
keySystem,
configurations: [configuration],
};
}
}
return null;
}
//# sourceMappingURL=getLegacyKeySystemAccess.js.map