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

Issue 38 - Cursor constraint #58

Merged
merged 2 commits into from
Jul 24, 2018
Merged

Issue 38 - Cursor constraint #58

merged 2 commits into from
Jul 24, 2018

Conversation

suhasHere
Copy link
Contributor

@suhasHere suhasHere commented Apr 12, 2018

Following up on the discussions in the issue, this PR adds cursor constraint that enumerates the conditions for capturing the cursor.

@suhasHere suhasHere requested review from juberti and martinthomson and removed request for juberti July 21, 2018 18:52
@suhasHere suhasHere changed the title Issue 38 - Boolean Cursor constraint Issue 38 - Cursor constraint Jul 21, 2018
Copy link
Member

@martinthomson martinthomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to change the authors in a separate PR, but this looks fine.

Do you think that there is any point in mentioning that the browser needs to determine how long to render the cursor for after movement stops?

index.html Outdated
@@ -245,7 +245,7 @@ <h2 id="display-constraints">
New Constraints for Captured Display Surfaces
</h2>
<p>
Two constraints are defined that allow an application to observe properties of the
Following new constraints are defined that allow an application to observe properties of the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "the"

@suhasHere
Copy link
Contributor Author

thanks @martinthomson for the review.

Sure adding a statement to remove the cursor when there is no movement might be handy. Would something like this work ?

"The captured cursor is removed when there is no further movement of the pointer for certain period of time (as determined by the user agent) to ensure smoother user experience."

@martinthomson
Copy link
Member

Yeah, that works. I would drop the tail: "The captured cursor is removed when there is no further movement of the pointer for certain period of time, as determined by the <a>user agent</a>."

@suhasHere suhasHere merged commit 965ce0f into gh-pages Jul 24, 2018
<dfn><code id="idl-def-CursorCaptureConstraint.always">always</code></dfn>
</td>
<td>
a <a>always</a> cursor capture constraint includes the cursor in the captured display surface.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a -> an

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juberti my bad .. I will get this fixed.

Two constraints are defined that allow an application to observe properties of the
selected <a>display surface</a>. Since the source of media cannot be changed after a
Following new constraints are defined that allow an application to observe the properties
of the selected <a>display surface</a>. Since the source of media cannot be changed after a
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence seems wrong - we do want the app to change the constraints, not just observe them.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.

@suhasHere, we need to reframe this section. Rather than do the obvious, and split the section on constraints into two, we should make it clear that though constraints don't affect selection (as much as people might like them to), they still affect the shape of the stream that is produced.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juberti @martinthomson I was planning to do constraints related work in a separate PR that also deals with bringing back few constraints as decided in the last meeting. Would it be ok, if I address the general constraints ideas in there ?

@juberti
Copy link

juberti commented Jul 24, 2018

Think this one still needs a bit more work.

@guest271314
Copy link
Contributor

@juberti FYI Tried .getDisplayMedia({video: {cursor: "never"}}), videoTrack.applyConstraints({cursor: "never"}) and videoTrack.cursor = "never" at Chromium 72. Neither removed the cursor entirely from the captured media stream

cursor

cursor_1

After setting the constraints videoTrack.getSettings()

https://developer.mozilla.org/en-US/docs/Web/API/MediaStreamTrack/getConstraints#Return_value

To get the currently active settings for all constrainable properties, you should instead call getSettings().

the resulting object still had cursor set to "always"

{aspectRatio: <value>
cursor: "always" // after applying constraints to the (video) `MediaStreamTrack`
deviceId: <value>
displaySurface: <value>
frameRate: <value>
height: <value>
logicalSurface: <value>
resizeMode: <value>
videoKind: <value>
width: <value>}

Outside of using .pointerLock() CSS element {cursor:none} was the code that resulted in the cursor not being rendered as part of the media stream.

The screen-capture directory at wpt there does not appear to include a test for cursor.

@guest271314
Copy link
Contributor

@CapOM
Copy link

CapOM commented Sep 12, 2020

Hi, can you confirm that when a capture is started through .getDisplayMedia({video: {cursor: "always"}}) then later on a call to videoTrack.applyConstraints({cursor: "never"}) should make the cursor disappear on the fly, without the need to re-select the source ? I.e. further calls to never and always on the track must be supported to allow developers to show and hide cursor when needed without requiring to restart the capture pipeline.
Refs: https://w3c.github.io/mediacapture-main/#dfn-applyconstraints-algorithm and https://w3c.github.io/mediacapture-main/#dfn-selectsettings .
It looks to me that the spec allows that but it is up to the implementation to decide whether to succeed or fail.
I wonder if it would be possible to make it a requirement or at least have a way to query if the implementation supports that.
Thx!

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.

5 participants