- From: Jan-Ivar Bruaroey via GitHub <sysbot+gh@w3.org>
- Date: Wed, 19 Oct 2022 17:06:47 +0000
- To: public-webrtc-logs@w3.org
Let's take a step back then. My main point was:
> we seem overdue for the third option IMHO... a rudimentary messaging API.
Do we agree on this?
This issue already tries to reinvent handle, opening up for alternative ideas. Neither a string identifier nor a traditional message port seem to satisfy requirements, so some innovation seems unavoidable. Since iteration has failed us, I think we need to reexamine the requirements, and figure out what shape makes most sense for them.
With this issue and https://github.com/w3c/mediacapture-handle/issues/11, `handle` is veering toward reinventing [broadcastChannel.postMessage](https://html.spec.whatwg.org/multipage/web-messaging.html#dom-broadcastchannel-postmessage-dev) except across origins IMHO. At the same time, [permittedOrigins](https://w3c.github.io/mediacapture-handle/identity/index.html#dom-capturehandleconfig-permittedorigins) smells like a list of [targetOrigin](https://html.spec.whatwg.org/multipage/window-object.html#dom-windowpostmessageoptions-targetorigin)s, a feature [window.postMessage](https://html.spec.whatwg.org/multipage/web-messaging.html#posting-messages). And lastly, a [MessagePort](https://html.spec.whatwg.org/multipage/web-messaging.html#messageport) can only be transferred over the latter (since broadcast naturally cannot transfer).
The previous paragraph mentions every object that implements `postMessage()` AFAIK, and while none of them fit, the idea that `postMessage` might at least be a shape we should consider hopefully seems reasonable.
So for sake of illustration only, we might imagine a broadcast-channel-like API with targetOrigin, something like:
```js
// capturee
navigator.mediaDevices.captureConfig.postMessage({id, hint, cropTarget}, "*");
navigator.mediaDevices.captureConfig.onmessage = e => iRecognize(e.origin) && my1on1Port = e.port;
// capturer
captureController.onmessage = e => {
if (iRecognize(e.origin)) {
const {port1, port2} = new MessageChannel();
my1on1Port = port1;
captureController.postMessage(port2, targetOrigin: e.origin);
}
```
--
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/mediacapture-handle/issues/68#issuecomment-1284321553 using your GitHub account
--
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 19 October 2022 17:06:49 UTC