From 09b042c44d61d1599ec18ca6e046b9b9de87c5ce Mon Sep 17 00:00:00 2001 From: Vincent den Boer Date: Wed, 16 Oct 2019 13:29:14 +0200 Subject: [PATCH] Fix for `react-native-webrtc` change to more standards-compliant behavior --- index.js | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/index.js b/index.js index 2fcea535..1b36c063 100644 --- a/index.js +++ b/index.js @@ -691,7 +691,7 @@ class Peer extends stream.Duplex { } // Promise-based getStats() (standard) - if (this._pc.getStats.length === 0) { + if (this._pc.getStats.length === 0 || this._isReactNativeWebrtc) { this._pc.getStats() .then(res => { var reports = [] @@ -701,16 +701,6 @@ class Peer extends stream.Duplex { cb(null, reports) }, err => cb(err)) - // Two-parameter callback-based getStats() (deprecated, former standard) - } else if (this._isReactNativeWebrtc) { - this._pc.getStats(null, res => { - var reports = [] - res.forEach(report => { - reports.push(flattenValues(report)) - }) - cb(null, reports) - }, err => cb(err)) - // Single-parameter callback-based getStats() (non-standard) } else if (this._pc.getStats.length > 0) { this._pc.getStats(res => {