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 code examples #16

Closed
fred-wang opened this issue Jun 23, 2023 · 3 comments
Closed

Add code examples #16

fred-wang opened this issue Jun 23, 2023 · 3 comments

Comments

@fred-wang
Copy link
Contributor

The screen capture spec has an basic example. I think we can similarly add a very basic one for this proposal (note that video is actually true by default):

  let controller = new CaptureController();
  controller.oncapturedmousechange = (event) => {
    console.log(`surfaceX=${event.surfaceX}, surfaceY=${event.surfaceY}`);
  }
  let mediaStream = await navigator.mediaDevices.getDisplayMedia({
    controller: controller
  });
  videoElement.srcObject = mediaStream;

Maybe we can also have some code examples to illustrate how RTCDataChannel can be used for peer-to-peer communication (#13) and how cursor constraint can be used to hide the mouse cursor for "efficiency enhancements during RTC" (#15).

Perhaps it should be in both the text of the spec and the explainer.

@eladalon1983
Copy link
Contributor

Wrt an example - sure, please feel free to send a PR! (I'd remove the videoElement line.)

Maybe we can also have some code examples to illustrate how RTCDataChannel can be used for peer-to-peer communication (#13)

Maybe. I worry that it might be a bit too involved. Wdyt? How many lines would it be?

and how cursor constraint can be used to hide the mouse cursor for "efficiency enhancements during RTC" (#15).

AFAICT these aren't yet implemented, so adding that atm might be misleading to some.

Perhaps it should be in both the text of the spec and the explainer.

That works for me.

@fred-wang
Copy link
Contributor Author

I had opened one PR for that some days ago: https://github.com/screen-share/captured-mouse-events/pulls

@fred-wang
Copy link
Contributor Author

Fixed by #18

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

No branches or pull requests

2 participants