TypeError: Cannot redefine property: ontrack
Browsers and versions affected Google Chrome Version 63.0.3239.132
Description 57 | unwrappedCb]); 58 | }; 59 | 60 | Object.defineProperty(proto, 'on' + eventNameToWrap, { 61 | get: function() { 62 | return this['_on' + eventNameToWrap]; 63 | },
I think requried check proto here: https://github.com/webrtc/adapter/blob/master/src/js/utils.js#L60
Steps to reproduce
Expected results
Actual results
do you have steps to reproduce?
Sorry, I think I did not correctly connect the component (via webpack).
the same problem .. Chrome update fixes this (why??), and what about users with not latest Chrome version
@fippo, hi!
Chrome 63.0.3239.132 version: There is no 'ontrack' property in window.PTCPeerConnection.prototype. Usually it's there, and with configurable: true, so your utils.js can redefine this.
And in this case, utils.js(line: 60) will create NEW property for this prototype, without configurable: true, I think it's wrong. And if something tries to redefine ontrack... you know, TypeError...
(Same problem in some Safari versions, I heared from my clients)
I used for testing: https://www.chrome-portable.com/ (GoogleChromePortable64_63.0.3239.132_online.paf.exe)
@goldreich if problem is actual, i do reopen issue/
And if something tries to redefine ontrack... you know, TypeError...
What is redefining ontrack?
Same problem here:

I have no idea what you are doing but looking at the chrome shim code https://github.com/webrtc/adapter/blob/650507360b2a57cea5e663cae1d27c78765cd3d2/src/js/chrome/chrome_shim.js#L21 it will only shim if it does not exist.
I actually ran into this on a project using puppeteer for tests on chrome 62. It's not that line that causes it, it falls down to the else, here which does not have the same check.
@xdumaine is shimOnTrack called twice?
I'm having same problem on my production website. Any solutions to this issue?
@fippo yes, it's also called from here: https://github.com/webrtc/adapter/blob/master/src/js/adapter_factory.js#L73
@xdumaine and where else?
Sorry, yes, that's the only place. Error is if adapter is included twice on the page. But I do think that that call (https://github.com/webrtc/adapter/blob/master/src/js/chrome/chrome_shim.js#L122) will be problematic if it's ever hit - this is saying if ontrack is in the prototype, then call wrapPeerConnectionEvent, which redefines it. Any time that else block is hit, this error will occur.
Optional solution is to use configurable: true here - https://github.com/webrtc/adapter/blob/master/src/js/utils.js#L60
Error is if adapter is included twice on the page.
ah... that makes sense. I would not recommend doing this. Adding configurable: true seems like the right thing to do since
Object.getOwnPropertyDescriptor(RTCPeerConnection.prototype, 'ontrack')
shows both configurable and enumerable as true
I have same error on adapter-6.3.0.min.js but not on chrome , just on electron's chrome
@orangebook can you open a new issue with steps to reproduce please?