-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mark keySystemAccess as default to null and optional and robustness properties as no longer defaulting. #107
base: main
Are you sure you want to change the base?
Conversation
For robustness, its a little weird to have some fields in the dictionary with defaults and others without due to this validity nuance. What if we patch the validity algo to say: If keySystemConfiguration.audioRubstness is not the empty string (""), audio MUST also be present. Also, I misspelled audioRubstness and videoRubstness in the spec. |
I think the only edge case where your solution wouldn't catch an issue is if someone does set Edit: we can also purposefully keep this edge case not covered but I'm not sure it's worth doing just for the sake of a cleaner IDL. |
Maybe thats a good thing? If empty is effectively the default (via algo), and if empty means "no robustness requirements", then having someone explicitly set this field to empty doesn't have to be an error if audio isn't present. Its a bit weird for a user to do this, but it doesn't break us or make the input ambiguous so I don't mind. I think both IDL and algo are simpler this route. |
Just to clarify, the case I have in mind is:
which would translate in EME to something like:
and would therefore not be valid. We would need to at least add logic to handle this case. |
index.bs
Outdated
@@ -461,8 +461,8 @@ spec: workers; urlPrefix: https://www.w3.org/TR/workers/# | |||
dictionary MediaCapabilitiesKeySystemConfiguration { | |||
required DOMString keySystem; | |||
DOMString initDataType = ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of doing the same thing to initDataType. It suffers the same issue of always being present.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is different: for audio and video robustness, we have logic that says that if you set one or the other, there must be a configuration. Issue is that if you create a MediaCapabilitiesKeySystemConfiguration
, per spec, it will set these two properties and always fail the check in https://w3c.github.io/media-capabilities/#mediaconfiguration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is resolved by #138 (the nested audio/video =dictionary is optional and non-defaulted)
index.bs
Outdated
@@ -743,9 +742,18 @@ spec: workers; urlPrefix: https://www.w3.org/TR/workers/# | |||
<code>config.audio.contentType</code>. | |||
</li> | |||
<li> | |||
Set the {{EME/robustness}} attribute to | |||
Let <var>robustness</var> be a string <code>DOMString</a> | |||
initialized to the empty string (<code>""</code>). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After sitting on this a bit more I think the approach is fine.
We might simplify what you have here even further with something like:
"if audioRobustness is present, set EME robustness attribute to config.keySystemConfig.audioRobustness"
And simply do nothing if it audioRobustness is not present. The default value from the EME config is "", so doing nothing should cause that default to take hold.
Maybe thats too subtle? Open to either route.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion. In general, I find having clear defaults better than relying on side effects but if you feel strongly, I'm happy to update the PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"be a string DOMString"
Do you mean to say 'string' twice - just DOMString?
Set the robustness attribute to robustness.
How about this change in wording/style?
If config.keySystemConfiguration.videoRobustness is present, set robustness to config.keySystemConfiguration.videoRobustness. Otherwise, set robustness to "".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed "string DOMString".
For the wording, the way I see it is that I prefer:
let robustness = "";
if (config.keySystemConfiguration.videoRobustness)
robustness = config.keySystemConfiguration.videoRobustness;
over:
let robustness = config.keySystemConfiguration.videoRobustness
? config.keySystemConfiguration.videoRobustness
: "";
(reason is that I prefer to have the default clear if there is one)
It's pretty much the same at the end so if you think it's clearer, I'm happy to apply the change.
…roperties as no longer defaulting.
335ebaf
to
51b4b61
Compare
I think with the recent change to nest robustness under a track config, the default of "" is no longer at odds with present (you check for the parent). But the null key system access still makes sense. |
I rebased this PR, but it seems to have been based on an earlier version of the spec, so it will need more updates before it can land. |
The prose now should make sense with the current spec. I also incorporated the change from #223 since that was discussed as part of this PR. I am not convinced that the spec steps need to be explicit about the default for robustness though. It is defined as a non-nullable DOMString in the IDL, it already has a default of "", and the corresponding EME attribute has a default of "". Also note that the situation #107 (comment) (an audio robustness property without an audio KeySystemTrackConfiguration) is no longer possible. It may be enough to check that it exists in the dictionary before copying the value over. |
@xhwang-chromium If you have time to take a look it would be appreciated, as this deals with the EME integration part of the spec. |
In the IDL, dictionary KeySystemTrackConfiguration { I it seems to me we don't need to have an explicit step to assign empty string to |
Updated per feedback from @xhwang-chromium to remove the robustness default. |
This is solving two issues:
required
for an object seems to not allownull
, at least in Chrome bindings. It occurs to me that defaulting tonull
is doing what we were trying to achieve and works better with the bindings. I will assume that Chrome bindings are following the spec here. I did not double-check.video
andaudio
being present, we actually are always doing the check because per WebIDL, a property with a default value is always present. I had to put in prose the default value.Preview | Diff
Preview | Diff