adapter
adapter copied to clipboard
Break classes that extend RTCPeerConnection
- [X] I have provided steps to reproduce (e.g. a link to a jsfiddle)
- [X] I have provided the browser name, version, and adapter.js version
- [X] 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.
- Go to the example with adapter, and open Devtools.
- 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
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? 🤔