Skip to content
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

Add note about deviceId and groupId inconsistency with other capabilities. #942

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

jan-ivar
Copy link
Member

@jan-ivar jan-ivar commented Mar 24, 2023

Fixes #941.


Preview | Diff

@jan-ivar jan-ivar self-assigned this Mar 24, 2023
@eladalon1983
Copy link
Member

Could you please help me figure out a hypothetical Web app that'd benefit of this change?

@jan-ivar
Copy link
Member Author

It would simplify any app that throws up a user interface to modify constraints. But the overall benefit here is to simplify the logic. The fact that few actual apps rely on it actually helps with that.

@alvestrand
Copy link
Contributor

We have used sequence to indicate a bounded set of possible values, I'm not sure if this syntax was chosen to indicate an unknowable set of values.

From the constrainable pattern text:

"Capabilities is a dictionary containing one or more key-value pairs, where each key MUST be a constrainable property, and each value MUST be a subset of the set of values allowed for that property. "

Query: should there be a recommendation that the value given is the default device for that type, and that more values should only be added if they would be returned in navigator.mediaDevices? Or is that making life more complicated?

@jan-ivar
Copy link
Member Author

The history here is that settings, capabilities, and constraints originally all used the same single WebIDL dictionary, MediaTrackConstraintSet. This made sense from a spec economy pov, since you can express both settings and capabilities as constraints. I.e. settings and capabilities are subsets of constraints (and also valid arguments to constraints, even today).

But then we realized this was a parsing nightmare for JS, since no guarantees were given in prose about how a value would be returned, e.g. in getCapabilities().

JS would in theory have to be ready for a user agent to return e.g. {channelCount: 1 or {channelCount: [1]} or {channelCount: {exact:1} or {channelCount: {exact: [1]}. And that this was terrible for web compat.

It was when making this transition to tripple dictionaries that this editorial mistake was introduced IMHO.

@jan-ivar jan-ivar marked this pull request as ready for review May 11, 2023 14:42
@jan-ivar
Copy link
Member Author

Folks prefer an oops note instead.

@jan-ivar jan-ivar changed the title Make deviceId and groupId consistent with other capabilities. Add note about deviceId and groupId inconsistency with other capabilities. Sep 20, 2023
@alvestrand alvestrand merged commit 94b8ed1 into w3c:main Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spec-inherent capabilities of one differ from other capabilities of one, an unnecessary variant
4 participants