webrtcHacks / adapter

Shim to insulate apps from spec changes and prefix differences. Latest adapter.js release:

Home Page:https://webrtcHacks.github.io/adapter/adapter-latest.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Break classes that extend RTCPeerConnection

matiaslopezd opened this issue · comments

  • I have provided steps to reproduce (e.g. a link to a jsfiddle)
  • I have provided the browser name, version, and adapter.js version
  • This issue only happens when adapter.js is used

Versions affected

  • Safari iOS 15.2 (Error visible on Devtools)
  • Safari macOS 15.6 (Error visible on Devtools)
  • Chrome 104.0.5112.79 Linux
  • Firefox 104.0.2 Linux
  • Chrome

adapter.js: 8.0.0

Warning
The provided example uses the latest CDN version!

Description

I'm using a custom class that extends RTCPeerConnection.

class MyCustomPeer extends RTCPeerConnection {...}

On the constructor, I call a static method which triggers a TypeError:

TypeError: this.constructor.myStaticMethod is not a function. (In 'this.constructor.myStaticMethod()', 'this.constructor.myStaticMethod' is undefined)

Mainly only shows on iOS and Mac (Safari), meanwhile, Chrome and Firefox on any OS do not trigger an error but the behavior is volatile like sometimes not dispatching the icecandidate and track events.

Steps to reproduce

Note
Use Safari on Mac or iOS, the only browsers returning a visible error.

  1. Go to the example with adapter, and open Devtools.
  2. Go to the example without adapter, and open Devtools.

Expected results

Create a class that extends RTCPeerConnection without issues.

Actual results

Overrides all static and non-static methods.

Related issue

#1010

Screenshot

image

what might contribute is that the safari shim is still wrapping the peerconnection constructor here:
https://github.com/webrtcHacks/adapter/blob/master/src/js/safari/safari_shim.js#L235

@dagingaa any ideas?

Any update? 🤔