LibWeb/EME: Implement is_supported_key_system

This commit is contained in:
stelar7 2025-07-31 13:28:31 +02:00 committed by Jelle Raaijmakers
commit c9b3365286
Notes: github-actions[bot] 2025-08-27 07:59:16 +00:00
2 changed files with 22 additions and 0 deletions

View file

@ -399,4 +399,24 @@ Optional<ConsentConfiguration> get_supported_configuration(KeySystem const& impl
return supported_configuration;
}
// https://w3c.github.io/encrypted-media/#dfn-common-key-systems
bool is_supported_key_system(Utf16String const& key_system)
{
constexpr Array<Utf16View, 1> supported_key_systems = {
// https://w3c.github.io/encrypted-media/#clear-key
"org.w3.clearkey"sv,
};
return supported_key_systems.contains_slow(key_system);
}
NonnullOwnPtr<KeySystem> key_system_from_string(Utf16String const& key_system)
{
if (key_system == "org.w3.clearkey"_utf16) {
return adopt_own(*new ClearKeySystem());
}
VERIFY_NOT_REACHED();
}
}

View file

@ -17,6 +17,8 @@ namespace Web::EncryptedMediaExtensions {
bool supports_container(Utf16String const& container);
bool is_persistent_session_type(Utf16String const& session_type);
bool is_supported_key_system(Utf16String const& key_system);
NonnullOwnPtr<KeySystem> key_system_from_string(Utf16String const& key_system);
ConsentStatus get_consent_status(Bindings::MediaKeySystemConfiguration const&, MediaKeyRestrictions&, URL::Origin const&);
Optional<Vector<Bindings::MediaKeySystemMediaCapability>> get_supported_capabilities_for_audio_video_type(KeySystem const&, CapabilitiesType, Vector<Bindings::MediaKeySystemMediaCapability>, Bindings::MediaKeySystemConfiguration, MediaKeyRestrictions);
Optional<ConsentConfiguration> get_supported_configuration_and_consent(KeySystem const&, Bindings::MediaKeySystemConfiguration const&, MediaKeyRestrictions&, URL::Origin const&);