diff --git a/package.json b/package.json index 3100954a36085a642d474a1a828c5c59b5b3fc1a..93b48be0197e65d883baf563fe45c40eda570fda 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "dependencies": { "lodash.clonedeep": "^4.3.2", "sdp-jingle-json": "^3.0.0", - "webrtc-adapter": "^2.0.2", + "webrtc-adapter": "^3.1.0", "wildemitter": "1.x" }, "devDependencies": { diff --git a/rtcpeerconnection.js b/rtcpeerconnection.js index a973faedda0d39c0bcbbe1de803abb94adae7ea9..92f7096593457b87ef51cefd73b52147918bdd43 100644 --- a/rtcpeerconnection.js +++ b/rtcpeerconnection.js @@ -885,15 +885,17 @@ PeerConnection.prototype.createDataChannel = function (name, opts) { return channel; }; -PeerConnection.prototype.getStats = function (cb) { - this.pc.getStats(null, - function (res) { +PeerConnection.prototype.getStats = function () { + if (typeof arguments[0] === 'function') { + var cb = arguments[0]; + this.pc.getStats().then(function (res) { cb(null, res); - }, - function (err) { + }, function (err) { cb(err); - } - ); + }); + } else { + return this.pc.getStats.apply(this.pc, arguments); + } }; module.exports = PeerConnection;