screen-share / element-capture

https://screen-share.github.io/element-capture/
18 stars 6 forks source link

What is the desired behavior for capturing the cursor? #38

Open eladalon1983 opened 9 months ago

eladalon1983 commented 9 months ago

What is the desired behavior for capturing the cursor?

IMHO, the cursor should:

  1. Only be visible in the captured video frames when the cursor over the target-element's bounding box. (Henceforth: TEBB.)
  2. When the cursor only partially intersects with the TEBB, the captured portion of the cursor should match the intersection with the TEBB.
  3. When the cursor is over the TEBB, the cursor should always be captured, even if there are (from a z-order perspective) intervening elements in between the target-element and the cursor.
  4. The cursor should always be drawn at the same offset to the TEBB as the user observes on their screen.
markafoltz commented 5 days ago

This seems reasonable to me.

However, as observed in Chrome, the cursor is painted separately from the content, typically by the underlying OS; and has to be re-rendered on top of the captured frame before delivery to consumers. The process of capturing the cursor position and re-rendering it is async from the rendering and capture of the element, so the captured element + cursor in the media stream will not match exactly what is rendered on-screen.

eladalon1983 commented 22 hours ago

Under normal conditions[*], I'd expect the discrepancy to be small wrt coordinates delta, short wrt time, privacy-trivial, and not impactful wrt usability. I could add the original proposal to the spec, but use SHOULD rather than MUST, then clarify with a note the possibility of discrepancies due to implementation inaccuracy. Wdyt?

-- [*] I.e. real human being operating a reasonable mouse, as opposed to software intentionally snapping the cursor around at high speed.

markafoltz commented 16 hours ago

Yes, the discrepancy should be small, but could be noticeable when e.g. dragging an element around.