Skip to content

Commit

Permalink
Fix for react-native-webrtc change to more standards-compliant beha…
Browse files Browse the repository at this point in the history
…vior
  • Loading branch information
ShishKabab committed Oct 16, 2019
1 parent f45d322 commit 09b042c
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand All @@ -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 => {
Expand Down

0 comments on commit 09b042c

Please sign in to comment.