-
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
Separate getDisplayMedia() algorithm; reintroduce constraints. #73
Conversation
Some explanation of this PR: After deliberating with other editors, I gave up trying to preserve the call to the I also added Privacy Indicator Requirements, since these were only implied before, and with the explicit call to Finally, the content changes:
|
index.html
Outdated
permissions, only the "Live" indicators are significant. | ||
</p> | ||
</div> | ||
<p>The User Agent MUST NOT implement the <code><a href= |
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.
"MUST NOT implement" sounds a bit strange. Would it be clearer to say "MUST NOT fire the devicechange event based on changes in the set of available sources for getDisplayMedia"?
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 Harald said.
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.
This looks pretty good. I think that we should settle on a single permission descriptor rather than two. I suggest "display", if only to match the API name. How browsers manage audio capture will be tricky enough in UX without having to worry about conjoined requests being hampered by permission discrepancies.
"!HTML52/browsers.html#top-level-browsing-context">top-level | ||
browsing context</a>'s <a data-cite= | ||
"!HTML52/browsers.html#active-document">active document</a>'s | ||
origin.</p> |
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.
Wow, what a mouthful. It's correct, but do we not have a shorthand for this we can use instead?
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.
That's existing prose copied from getUserMedia.
different from <var>originIdentifier</var>, set | ||
<var>originIdentifier</var> to the result of combining | ||
<var>originIdentifier</var> and the <a>current settings | ||
object</a>'s origin.</p> |
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 know what this means. (If this is a process defined in Feature Policy, then) you need a citation.
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.
Again, copied from getUserMedia.
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.
That doesn't make it good. It just means that you now have two incomprehensible statements.
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.
@martinthomson As such it makes this a non-change as far as this PR is concerned. Can you open an issue on mediacapture-main, and can we take care of it that way? It
Just trying to unblock this PR on feature policy and w3c/mediacapture-main#434.
index.html
Outdated
a display device, with a PermissionDescriptor with its name | ||
member set to the permission name associated with | ||
<var>kind</var> for obtaining display devices (e.g. "screen" | ||
for video), resulting in a set of provided media.</p> |
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 that "display" is better, and that we don't want to distinguish between video and audio capture in this context.
That's just my intuition here, so I'm open to arguments that suggest otherwise.
index.html
Outdated
<code><a>MediaStreamTrack</a></code> MUST NOT change.</p> | ||
<p>User Agents are encouraged to warn users against sharing | ||
<a>browser</a> display devices, or otherwise try to | ||
steer users away from sharing them.</p> |
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.
"or otherwise try to discourage their selection on the basis that these represent a significantly higher risk when shared"
and set the | ||
[[\devicesAccessibleMap]]<var>[deviceId]</var> to | ||
<code>true</code>, if it isn’t already | ||
<code>true</code>.</p> |
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.
We need to establish what deviceId
is here. My suggestion is that while it is valuable to interact with the gUM model in this way, you want to assign a unique deviceId
every time a capture is started here, only reusing the identifier while the same source is active. That needs to be part of the preceding steps of the algorithm here.
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.
This per-device permission stuff—which no-one implements btw—has already received (legitimate) flak for being overly complicated, so I worry about adding complexity to this. Since the deviceIds are never exposed, can we perhaps use the raw internal ids which are stable?
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.
If the point here is to support indicators, then sure.
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 needs clarification too.
The max constraint type lets a web application provide a maximum envelope | ||
for constrainable properties like width and height, should the | ||
end-user resize a <a>window</a> or <a>browser</a> surface while it | ||
is being captured. |
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.
This is a reasonable conclusion, but the choice on min/max doesn't seem particularly principled. Are there other constraints that might need similar treatment?
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.
Note that only max
is allowed. min
and exact
are disallowed.
There's no selection, only downscaling/decimating. We never upscale, so no min
needed.
Eliminating min
also avoids us having to worry about OverconstrainedError
after selection.
I don't anticipate constraints other than width
and height
needing this.
I don't anticipate needing other constraints types than min
, given this repurposing.
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.
You might explicitly state what constraints are allowed/disallowed.
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.
index.html
Outdated
permissions, only the "Live" indicators are significant. | ||
</p> | ||
</div> | ||
<p>The User Agent MUST NOT implement the <code><a href= |
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 Harald said.
@martinthomson @alvestrand Review feedback incorporated PTAL. |
values. This prevents an application from influencing the selection of sources, see | ||
<a href="#constraints"></a> for details. | ||
This method is similar to <code><a>getUserMedia</a></code>, except that it | ||
acquires media from one display device chosen by the end-user each time. |
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.
"one display device" sounds like single-monitor only?
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.
We might add a definition of "a display device", something like "In this context, a display device consists of all the display surfaces that are presented to the user to choose from."
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 covered by "Multiple monitors might also be aggregated into as a single logical monitor."
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 put down several comments, but I think they can be addressed separately. This PR is blocking other stuff, and most of the nits are inherited from GUM.
<li> | ||
<p>Let <var>requestedMediaTypes</var> be the set of media | ||
types in <var>constraints</var> with either a dictionary | ||
value or a value of <code>true</code>.</p> |
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 set of media types in constraints" sounds like a specific member inside of constraints, can this be clarified? I think its meant to say that requestedMediaTypes is the set of the same members as in constraints but only those whose value is either a dictionary or the value true.
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.
@henbos Copied from mediacapture-main.
"media type" seems defined by extension to be audio or video, referring here to the key names "audio" or "video" in e.g. constraints like {audio: true, video: {}}
.
The type of elements in the set requestedMediaTypes
doesn't seem super-relevant as long as it distinguishes audio vs. video and future types, though it seems safe to infer string IMHO. Please open an issue on mediacapture-main if you think this isn't clear.
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.
It's really more of a template argument than a string I suppose. We do gymnastics like:
"For each media type T in requestedMediaTypes, ... If the value of the T entry of constraints is "true""
E.g. if unrolled, would read "if the value of the audio entry of constraints" and again for video.
<li> | ||
<p>If <var>requestedMediaTypes</var> is the empty set, set | ||
<var>requestedMediaTypes</var> to a set containing | ||
<code>"video"</code>.</p> |
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.
Should this be "video:true"?
<p>Run the following steps in parallel:</p> | ||
<ol> | ||
<li> | ||
<p>For each media type <var>T</var> in |
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.
Is "media type" well defined? Should it be or a link, or somewhere clarified that this is "audio" or "video"?
<var>originIdentifier</var>, <a>prompt the user to choose</a> | ||
a display device, with a PermissionDescriptor named | ||
<code>"display"</code>, resulting in a set of | ||
provided media.</p> |
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.
'with a PermissionDescriptor named "display",'
I'm sure this was copied from GUM, but I don't know what this means, should we file an issue?
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.
nit: '... or in "rejected".'?
each media type in <var>requestedMediaTypes</var>. | ||
The devices chosen MUST be the ones determined by the user. | ||
Once selected, the source of a | ||
<code><a>MediaStreamTrack</a></code> MUST NOT change.</p> |
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.
This sentence may be up for interpretation and debatable. You may share an application, whose set of windows changes or resizes, or where the source is N/A during the time something is minimized, or we may add language about what to do if the set of monitors changes. Or something.
This is OK but we may need to revisit it.
and set the | ||
[[\devicesAccessibleMap]]<var>[deviceId]</var> to | ||
<code>true</code>, if it isn’t already | ||
<code>true</code>.</p> |
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 needs clarification too.
provided media.</p> | ||
<p>The provided media MUST include precisely one track of | ||
each media type in <var>requestedMediaTypes</var>. | ||
The devices chosen MUST be the ones determined by the user. |
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.
nit: Language like "devices" should be updated, we're talking about display surfaces.
<a href="#create-permission">create a permission storage entry</a> | ||
with a value of "granted". | ||
</p> | ||
<p>If the result is "denied", jump to the step labeled |
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.
nit: I'm not sure its clear what the possible results are.
"https://w3c.github.io/mediacapture-main/#dfn-applyconstraints-algorithm"> | ||
<dfn>ApplyConstraints algorithm</dfn></a> on all | ||
tracks in <var>stream</var> with the appropriate | ||
constraints. Should this fail, let <var>failedConstraint</var> |
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.
nit: "with the appropriate constraints" should be clarified. As-is, both boolean and constraint set values are allowed (do we need to convert "true" to "{}"?), and it is not explicit about applying "audio" constraints to audio and "video" constraints to video. This may seem obvious but as an algorithm step it is vague.
<li> | ||
<p>If <var>value</var> contains a member which in turn | ||
is a dictionary containing a member named either | ||
<code>min</code> or <code>exact</code>, return a promise |
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.
(If it turns out that there are meaningful differences between exact and ideal in the case of boolean constraints we can revisit this separately.)
Comments to be addressed separately. |
Fix for #49.