@svta/common-media-library
Version:
A common library for media playback in JavaScript
25 lines • 1.03 kB
JavaScript
import { createMediaKeySystemConfiguration } from './createMediaKeySystemConfiguration.js';
import { getSupportedKeySystemConfiguration } from './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
*/
export function getLegacyKeySystemAccess(requests) {
for (const { keySystem, configurations } of requests) {
const supportedConfig = getSupportedKeySystemConfiguration(keySystem, configurations);
if (supportedConfig) {
const configuration = createMediaKeySystemConfiguration(supportedConfig.supportedAudio, supportedConfig.supportedVideo);
return {
keySystem,
configurations: [configuration],
};
}
}
return null;
}
//# sourceMappingURL=getLegacyKeySystemAccess.js.map