Skip to content

Commit

Permalink
Merge pull request #511 from cordova-rtc/bugs/getStats
Browse files Browse the repository at this point in the history
fix RTCPeerConnection.prototype.getStats.length to match features detection
  • Loading branch information
hthetiot committed May 24, 2020
2 parents ac93724 + df3105c commit d4eeea4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion dist/cordova-plugin-iosrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2495,6 +2495,10 @@ function RTCStatsResponse(data) {
return data;
};

this.forEach = function (callback, thisArg) {
return data.forEach(callback, thisArg);
};

this.namedItem = function () {
return null;
};
Expand Down Expand Up @@ -3133,7 +3137,7 @@ function requestPermission(needMic, needCamera, callback) {
}

function callbackifyMethod(originalMethod) {
return function () {
return function (arg) { // jshint ignore:line
var success, failure,
originalArgs = Array.prototype.slice.call(arguments);

Expand Down Expand Up @@ -3180,6 +3184,7 @@ function restoreCallbacksSupport() {
callbackifyPrototype(RTCPeerConnection.prototype, 'setRemoteDescription');
callbackifyPrototype(RTCPeerConnection.prototype, 'setLocalDescription');
callbackifyPrototype(RTCPeerConnection.prototype, 'addIceCandidate');
callbackifyPrototype(RTCPeerConnection.prototype, 'getStats');
}

function registerGlobals(doNotRestoreCallbacksSupport) {
Expand Down
4 changes: 4 additions & 0 deletions js/RTCStatsResponse.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ function RTCStatsResponse(data) {
return data;
};

this.forEach = function (callback, thisArg) {
return data.forEach(callback, thisArg);
};

this.namedItem = function () {
return null;
};
Expand Down
3 changes: 2 additions & 1 deletion js/iosrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function requestPermission(needMic, needCamera, callback) {
}

function callbackifyMethod(originalMethod) {
return function () {
return function (arg) { // jshint ignore:line
var success, failure,
originalArgs = Array.prototype.slice.call(arguments);

Expand Down Expand Up @@ -169,6 +169,7 @@ function restoreCallbacksSupport() {
callbackifyPrototype(RTCPeerConnection.prototype, 'setRemoteDescription');
callbackifyPrototype(RTCPeerConnection.prototype, 'setLocalDescription');
callbackifyPrototype(RTCPeerConnection.prototype, 'addIceCandidate');
callbackifyPrototype(RTCPeerConnection.prototype, 'getStats');
}

function registerGlobals(doNotRestoreCallbacksSupport) {
Expand Down

0 comments on commit d4eeea4

Please sign in to comment.