[encrypted-media] sessionTypes: sequence of DOMString vs sequence of MediaKeySessionType

xhwang-chromium has just created a new issue for https://github.com/w3c/encrypted-media:

== sessionTypes: sequence of DOMString vs sequence of MediaKeySessionType ==
This is about the `sessionTypes` in `MediaKeySystemConfiguration` in the EME spec. For historically backgrounds, see issue #260 and #47.

The spec defines `sessionTypes` as:

> `sessionTypes` of type sequence \<DOMString\> 
>     A list of `MediaKeySessionTypes` that must be supported. All values must be supported.

This is causing an issue in [3.1.1.2 Get Supported Configuration and Consent](https://w3c.github.io/encrypted-media/#get-supported-configuration-and-consent), step 13 and 13.1

> 13 For each value in session types:
> 13.1 Let session type be the value.

Here the `session type` is still a DOMString, but is passed to [Is persistent session type?](https://w3c.github.io/encrypted-media/#is-persistent-session-type) algorithm, which expects a `MediaKeySessionType` value as input. So it seems we are missing a DOMString to MediaKeySessionType conversion somewhere.

Using a DOMString has another issue that it makes it much harder to catch typos. For example, if we get `NotSupportedError` for `sessionTypes: ['persistent-licence']`, the author of the JS player may think that persistent license is not supported, but actually it's just a typo in the "licen**c**e".

With that, should `sessionTypes` be defined as sequence<MediaKeySessionType>? That'll solve both issues above. For the typo example, `TypeError` will be returned immediately.

One argument of using the DOMString is that it allows nice forward compatibility. See see issue #260 and #47. But at least we need to fix the missing type conversion in the spec.

Please view or discuss this issue at https://github.com/w3c/encrypted-media/issues/447 using your GitHub account

Received on Wednesday, 7 November 2018 20:35:28 UTC