Re: [mediacapture-region] Why expose produceCropTarget at MediaDevices level? (#11)

@alvestrand I think you're hyper-focusing on the cross-origin use case (another symptom of the current API shape?)

`cropTo` needs to crop to elements from the same context as well, which is what I show for brevity (I showed postMessage [earlier](https://github.com/w3c/mediacapture-region/issues/11#issuecomment-1112514784)). It's so ergonomic it renders #19 (which argues for a different API for that essentially, just to work around an unappealing API) moot. Another API win, since special-casing hurts learning & comprehension.

We should make minting cropTargets so trivial that cropTo accepts *only* that, to teach people how to use it once. KISS:
```js
await track.cropTo(element.cropTarget); // same document
await track.cropTo(iframe.contentDocument.getElementById('foo').cropTarget); // same origin
window.onmessage = async ({data: cropTarget}) => await track.cropTo(cropTarget); // any origin
```


-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/mediacapture-region/issues/11#issuecomment-1126934670 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 15 May 2022 12:56:23 UTC