Re: [webrtc-extensions] Potential web compat issue with setOfferedRtpHeaderExtensions (#130)

The second case doesn't fail in some browsers and not others. That seems better.

The first case fails to explain why we have [headerExtensionsToOffer](https://w3c.github.io/webrtc-extensions/#dom-rtcrtptransceiver-headerextensionstooffer).

It also seems unfair to compare sunny-case pseudo code that utterly fails to negotiate what the browser is capable of.

If we're going to compare simplicity, we should maybe compare realistic code with the same properties. Something like:
```js
try {
  transceiver.setOfferedRtpHeaderExtensions([
    {uri: "urn:ietf:params:rtp-hdrext:origin-timestamp", direction: "sendrecv"},
    {uri: "urn:ietf:params:rtp-hdrext:new-fancy-reporting", direction: "send"}
  ]);
} catch (e) {
  if (e.name != "NotSupportedError") throw e;
  transceiver.setOfferedRtpHeaderExtensions([
    {uri: "urn:ietf:params:rtp-hdrext:origin-timestamp", direction: "sendrecv"}
  ]);
}
```
vs.
```js
const headers = transceiver.getHeaderExtensionsToOffer(); // #137
for (const header of headers) {
  if (header.uri == "urn:ietf:params:rtp-hdrext:origin-timestamp") {
    header.direction = "sendrecv";
  }
  if (header.uri == "urn:ietf:params:rtp-hdrext:new-fancy-reporting") {
    header.direction = "send";
  }
}
transceiver.setOfferedRtpHeaderExtensions(headers);
```


-- 
GitHub Notification of comment by jan-ivar
Please view or discuss this issue at https://github.com/w3c/webrtc-extensions/issues/130#issuecomment-1344848846 using your GitHub account


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

Received on Friday, 9 December 2022 22:29:06 UTC