feross / simple-peer

📡 Simple WebRTC video, voice, and data channels
MIT License
7.41k stars 971 forks source link

Support spec-compliant getStats() only #156

Open feross opened 7 years ago

feross commented 7 years ago

"Firefox has supported getStats to the spec for a couple of years now, and Chrome Canary finally has a spec-compliant version, so it’s a good time to check in how to write code that (soon!) will work across browsers."

https://blog.mozilla.org/webrtc/fiddle-week-spec-compliant-getstats/

Once Canary progresses to stable (in ~12 weeks), we should consider only supporting the promises version. Other implementations can just assume no getStats exists, which only means that remoteAddress, remotePort properties will be undefined. No big deal.

eordano commented 4 years ago

Bump! <3

nazar-pc commented 4 years ago

@eordano it is already supported actually: https://github.com/feross/simple-peer/blob/947d873540ee337f990ce00a341de4a7aea1cacc/index.js#L697-L706

eordano commented 4 years ago

Hi there! Doesn't this issue refer to deprecating the other version? In any case -- I think this can be closed down.

I think I run into an issue related to this code path because of the inclusion of one shim over the other -- for some reason getStats.length became 1; and it was receiving a callback (error didn't have to do with simple-peer, but this issue would be a cool "clean up").

Original discussion here: https://github.com/feross/simple-peer/issues/470 ( TypeError: Argument 1 of RTCPeerConnection.getStats does not implement interface MediaStreamTrack.)