- From: Jan-Ivar Bruaroey <notifications@github.com>
- Date: Wed, 10 Jul 2024 13:44:52 -0700
- To: whatwg/streams <streams@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <whatwg/streams/pull/1318/review/2170252187@github.com>
@jan-ivar commented on this pull request. > <xmp highlight="js"> - const { readable, writable } = createEndpointPair(); - readable.pipeThrough(new TransformStream(...)).pipeTo(writable); + async function handleTransformer({readable, writable}) { + await readable.pipeThrough(new TransformStream(...)).pipeTo(writable); + } </xmp> I read _"web-platform-provided function `createEndpointPair()`"_ as a callout to the same-shaped `sender.createEncodedStreams()` method removed in https://github.com/w3c/webrtc-encoded-transform/pull/64. I was trying to maintain this similarity to the API it's referencing. But the [spec](https://w3c.github.io/webrtc-encoded-transform/#rtcrtpscripttransformer)'s [worker-only](https://w3ctag.github.io/design-principles/#worker-only) API is different. From [MDN](https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Using_Encoded_Transforms#basic_webrtc_encoded_transform) and [blog post](https://blog.mozilla.org/webrtc/end-to-end-encrypt-webrtc-in-all-browsers/) examples: ```js // main.html const worker = new Worker("worker.js"); sender.transform = new RTCRtpScriptTransform(worker); // worker.js onrtctransform = async ({transformer: {readable, writable}}) => { await readable.pipeThrough(new TransformStream(...)).pipeTo(writable); }; ``` The spec fires an event with the transformer which has no constructor. The event part seemed unnecessary but I can try to add it if the context is useful. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/streams/pull/1318#discussion_r1672961827 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/streams/pull/1318/review/2170252187@github.com>
Received on Wednesday, 10 July 2024 20:44:57 UTC