-
Notifications
You must be signed in to change notification settings - Fork 28
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
Behavior for getDisplayMedia() and getDisplayMedia({}) should be the same #65
Comments
Thanks for posting this in detail foolip@. Note than creating a new dictionary type DisplayMediaConstraints will differentiate the usage of getUserMedia() and getDisplayMedia() further. i.e. getUserMedia() returns an exception whereas getDisplayMedia() returns a MediaStream. Alternatively we can make getDisplayMedia() work in a similar way, such that we return an exception when the constraints argument is omitted. |
It looks like a key difference will be there no matter what the IDL looks like, namely that The only way to avoid forking the IDL dictionary would be to remove the default value and handle a missing video member explicitly in both specs, but differently. |
Unfortunately, to make Perhaps it's better to recast this behavior not as a default value, but as the fallback behavior for when audio and video are both false? Written as an algorithm, that would be quite easy to express at least. |
My suggestion was that, getDisplayMedia() should also fail and not be a special case. That would be more consistent.
getDisplayMedia({ video: false }) returning a video stream does not sound right. |
I agree that the most straightforward change is to make getDisplayMedia() fail, just like getUserMedia() does. |
That would be a risky change for Edge which has already shipped However, I took a look in httparchive, and there are very few matches for 'getDisplayMedia' (13) and no matches for 'navigator.getDisplayMedia'. This suggests that there isn't much of a web compat contraint for this API yet. However, it'd still be best to poke from the Edge team about such a change. |
(The 13 matches were things like https://shared.nordstrom.com/rfx/v-1.0.6603.39355/Desktop/RfxPluginContent.js, no real uses of this API that I could see.) |
ping @aboba for Edge info |
May be OK now. |
This should be fixed now with #73. |
To clarify what I think @foolip is saying—because I tripped over it—an "empty dictionary" here isn't actually empty, but populated with its default values, which means all the following calls are indistinguishable: getDisplayMedia()
getDisplayMedia({})
getDisplayMedia({video: false})
getDisplayMedia({audio: false})
getDisplayMedia({video: false, audio: false}) // <-- what implementation prose sees Having our prose interpret all of these as
|
Alternatively, something like what @foolip proposed might work:
... with prose to throw TypeError on |
That seems like the best outcome. It's the expected mode. Then you only need to set the video option if you have constraints, or you want audio, both being somewhat exceptional. |
If dictionary DisplayMediaStreamConstraints {
MediaTrackConstraints video;
(boolean or MediaTrackConstraints) audio = false;
}; |
@foolip yes but then wouldn't I think people would expect those to work, for symmetry alone. People would then need to use |
I mean, if we're dropping symmetry, I'd argue for |
Sure, similarity to |
Fixed by #92 |
https://w3c.github.io/mediacapture-screen-share/#navigator-additions says:
However, this doesn't match the
MediaStreamConstraints
definition in https://w3c.github.io/mediacapture-main/#mediastreamconstraints:Here,
video
has a default value of false. Web IDL says in https://heycam.github.io/webidl/#dfn-optional-argument-default-value:In other words, per Web IDL, in this case,
constraints
is considered to have a default value of{}
, which means thatgetDisplayMedia()
andgetDisplayMedia({})
will be indistinguishable.getDisplayMedia({ audio: false })
should also have the same behavior ifaudio
has a default value offalse
, which it does here.The most straightforward fix for this would be to make the IDL match the wanted behavior, e.g.:
As a very unfortunate side effect
getDisplayMedia({ video: false })
andgetDisplayMedia({ video: undefined })
will not mean the same thing even thoughundefined
is a falsy value, but I don't see another great solution.The text was updated successfully, but these errors were encountered: