Skip to content

Commit 4fc929d

Browse files
committed
Add adapter artifacts
1 parent 49d3da7 commit 4fc929d

File tree

4 files changed

+94
-86
lines changed

4 files changed

+94
-86
lines changed

release/adapter.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -827,11 +827,11 @@ var chromeShim = {
827827
};
828828
});
829829

830-
// support for addIceCandidate(null)
830+
// support for addIceCandidate(null or undefined)
831831
var nativeAddIceCandidate =
832832
RTCPeerConnection.prototype.addIceCandidate;
833833
RTCPeerConnection.prototype.addIceCandidate = function() {
834-
if (arguments[0] === null) {
834+
if (!arguments[0]) {
835835
if (arguments[1]) {
836836
arguments[1].apply(null);
837837
}
@@ -2098,7 +2098,7 @@ var edgeShim = {
20982098
};
20992099

21002100
window.RTCPeerConnection.prototype.addIceCandidate = function(candidate) {
2101-
if (candidate === null) {
2101+
if (!candidate) {
21022102
this.transceivers.forEach(function(transceiver) {
21032103
transceiver.iceTransport.addRemoteCandidate({});
21042104
});
@@ -2335,11 +2335,11 @@ var firefoxShim = {
23352335
};
23362336
});
23372337

2338-
// support for addIceCandidate(null)
2338+
// support for addIceCandidate(null or undefined)
23392339
var nativeAddIceCandidate =
23402340
RTCPeerConnection.prototype.addIceCandidate;
23412341
RTCPeerConnection.prototype.addIceCandidate = function() {
2342-
if (arguments[0] === null) {
2342+
if (!arguments[0]) {
23432343
if (arguments[1]) {
23442344
arguments[1].apply(null);
23452345
}
@@ -2348,24 +2348,26 @@ var firefoxShim = {
23482348
return nativeAddIceCandidate.apply(this, arguments);
23492349
};
23502350

2351-
// shim getStats with maplike support
2352-
var makeMapStats = function(stats) {
2353-
var map = new Map();
2354-
Object.keys(stats).forEach(function(key) {
2355-
map.set(key, stats[key]);
2356-
map[key] = stats[key];
2357-
});
2358-
return map;
2359-
};
2351+
if (browserDetails.version < 48) {
2352+
// shim getStats with maplike support
2353+
var makeMapStats = function(stats) {
2354+
var map = new Map();
2355+
Object.keys(stats).forEach(function(key) {
2356+
map.set(key, stats[key]);
2357+
map[key] = stats[key];
2358+
});
2359+
return map;
2360+
};
23602361

2361-
var nativeGetStats = RTCPeerConnection.prototype.getStats;
2362-
RTCPeerConnection.prototype.getStats = function(selector, onSucc, onErr) {
2363-
return nativeGetStats.apply(this, [selector || null])
2364-
.then(function(stats) {
2365-
return makeMapStats(stats);
2366-
})
2367-
.then(onSucc, onErr);
2368-
};
2362+
var nativeGetStats = RTCPeerConnection.prototype.getStats;
2363+
RTCPeerConnection.prototype.getStats = function(selector, onSucc, onErr) {
2364+
return nativeGetStats.apply(this, [selector || null])
2365+
.then(function(stats) {
2366+
return makeMapStats(stats);
2367+
})
2368+
.then(onSucc, onErr);
2369+
};
2370+
}
23692371
}
23702372
};
23712373

release/adapter_no_edge.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,11 @@ var chromeShim = {
336336
};
337337
});
338338

339-
// support for addIceCandidate(null)
339+
// support for addIceCandidate(null or undefined)
340340
var nativeAddIceCandidate =
341341
RTCPeerConnection.prototype.addIceCandidate;
342342
RTCPeerConnection.prototype.addIceCandidate = function() {
343-
if (arguments[0] === null) {
343+
if (!arguments[0]) {
344344
if (arguments[1]) {
345345
arguments[1].apply(null);
346346
}
@@ -681,11 +681,11 @@ var firefoxShim = {
681681
};
682682
});
683683

684-
// support for addIceCandidate(null)
684+
// support for addIceCandidate(null or undefined)
685685
var nativeAddIceCandidate =
686686
RTCPeerConnection.prototype.addIceCandidate;
687687
RTCPeerConnection.prototype.addIceCandidate = function() {
688-
if (arguments[0] === null) {
688+
if (!arguments[0]) {
689689
if (arguments[1]) {
690690
arguments[1].apply(null);
691691
}
@@ -694,24 +694,26 @@ var firefoxShim = {
694694
return nativeAddIceCandidate.apply(this, arguments);
695695
};
696696

697-
// shim getStats with maplike support
698-
var makeMapStats = function(stats) {
699-
var map = new Map();
700-
Object.keys(stats).forEach(function(key) {
701-
map.set(key, stats[key]);
702-
map[key] = stats[key];
703-
});
704-
return map;
705-
};
697+
if (browserDetails.version < 48) {
698+
// shim getStats with maplike support
699+
var makeMapStats = function(stats) {
700+
var map = new Map();
701+
Object.keys(stats).forEach(function(key) {
702+
map.set(key, stats[key]);
703+
map[key] = stats[key];
704+
});
705+
return map;
706+
};
706707

707-
var nativeGetStats = RTCPeerConnection.prototype.getStats;
708-
RTCPeerConnection.prototype.getStats = function(selector, onSucc, onErr) {
709-
return nativeGetStats.apply(this, [selector || null])
710-
.then(function(stats) {
711-
return makeMapStats(stats);
712-
})
713-
.then(onSucc, onErr);
714-
};
708+
var nativeGetStats = RTCPeerConnection.prototype.getStats;
709+
RTCPeerConnection.prototype.getStats = function(selector, onSucc, onErr) {
710+
return nativeGetStats.apply(this, [selector || null])
711+
.then(function(stats) {
712+
return makeMapStats(stats);
713+
})
714+
.then(onSucc, onErr);
715+
};
716+
}
715717
}
716718
};
717719

release/adapter_no_edge_no_global.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -336,11 +336,11 @@ var chromeShim = {
336336
};
337337
});
338338

339-
// support for addIceCandidate(null)
339+
// support for addIceCandidate(null or undefined)
340340
var nativeAddIceCandidate =
341341
RTCPeerConnection.prototype.addIceCandidate;
342342
RTCPeerConnection.prototype.addIceCandidate = function() {
343-
if (arguments[0] === null) {
343+
if (!arguments[0]) {
344344
if (arguments[1]) {
345345
arguments[1].apply(null);
346346
}
@@ -681,11 +681,11 @@ var firefoxShim = {
681681
};
682682
});
683683

684-
// support for addIceCandidate(null)
684+
// support for addIceCandidate(null or undefined)
685685
var nativeAddIceCandidate =
686686
RTCPeerConnection.prototype.addIceCandidate;
687687
RTCPeerConnection.prototype.addIceCandidate = function() {
688-
if (arguments[0] === null) {
688+
if (!arguments[0]) {
689689
if (arguments[1]) {
690690
arguments[1].apply(null);
691691
}
@@ -694,24 +694,26 @@ var firefoxShim = {
694694
return nativeAddIceCandidate.apply(this, arguments);
695695
};
696696

697-
// shim getStats with maplike support
698-
var makeMapStats = function(stats) {
699-
var map = new Map();
700-
Object.keys(stats).forEach(function(key) {
701-
map.set(key, stats[key]);
702-
map[key] = stats[key];
703-
});
704-
return map;
705-
};
697+
if (browserDetails.version < 48) {
698+
// shim getStats with maplike support
699+
var makeMapStats = function(stats) {
700+
var map = new Map();
701+
Object.keys(stats).forEach(function(key) {
702+
map.set(key, stats[key]);
703+
map[key] = stats[key];
704+
});
705+
return map;
706+
};
706707

707-
var nativeGetStats = RTCPeerConnection.prototype.getStats;
708-
RTCPeerConnection.prototype.getStats = function(selector, onSucc, onErr) {
709-
return nativeGetStats.apply(this, [selector || null])
710-
.then(function(stats) {
711-
return makeMapStats(stats);
712-
})
713-
.then(onSucc, onErr);
714-
};
708+
var nativeGetStats = RTCPeerConnection.prototype.getStats;
709+
RTCPeerConnection.prototype.getStats = function(selector, onSucc, onErr) {
710+
return nativeGetStats.apply(this, [selector || null])
711+
.then(function(stats) {
712+
return makeMapStats(stats);
713+
})
714+
.then(onSucc, onErr);
715+
};
716+
}
715717
}
716718
};
717719

release/adapter_no_global.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -827,11 +827,11 @@ var chromeShim = {
827827
};
828828
});
829829

830-
// support for addIceCandidate(null)
830+
// support for addIceCandidate(null or undefined)
831831
var nativeAddIceCandidate =
832832
RTCPeerConnection.prototype.addIceCandidate;
833833
RTCPeerConnection.prototype.addIceCandidate = function() {
834-
if (arguments[0] === null) {
834+
if (!arguments[0]) {
835835
if (arguments[1]) {
836836
arguments[1].apply(null);
837837
}
@@ -2098,7 +2098,7 @@ var edgeShim = {
20982098
};
20992099

21002100
window.RTCPeerConnection.prototype.addIceCandidate = function(candidate) {
2101-
if (candidate === null) {
2101+
if (!candidate) {
21022102
this.transceivers.forEach(function(transceiver) {
21032103
transceiver.iceTransport.addRemoteCandidate({});
21042104
});
@@ -2335,11 +2335,11 @@ var firefoxShim = {
23352335
};
23362336
});
23372337

2338-
// support for addIceCandidate(null)
2338+
// support for addIceCandidate(null or undefined)
23392339
var nativeAddIceCandidate =
23402340
RTCPeerConnection.prototype.addIceCandidate;
23412341
RTCPeerConnection.prototype.addIceCandidate = function() {
2342-
if (arguments[0] === null) {
2342+
if (!arguments[0]) {
23432343
if (arguments[1]) {
23442344
arguments[1].apply(null);
23452345
}
@@ -2348,24 +2348,26 @@ var firefoxShim = {
23482348
return nativeAddIceCandidate.apply(this, arguments);
23492349
};
23502350

2351-
// shim getStats with maplike support
2352-
var makeMapStats = function(stats) {
2353-
var map = new Map();
2354-
Object.keys(stats).forEach(function(key) {
2355-
map.set(key, stats[key]);
2356-
map[key] = stats[key];
2357-
});
2358-
return map;
2359-
};
2351+
if (browserDetails.version < 48) {
2352+
// shim getStats with maplike support
2353+
var makeMapStats = function(stats) {
2354+
var map = new Map();
2355+
Object.keys(stats).forEach(function(key) {
2356+
map.set(key, stats[key]);
2357+
map[key] = stats[key];
2358+
});
2359+
return map;
2360+
};
23602361

2361-
var nativeGetStats = RTCPeerConnection.prototype.getStats;
2362-
RTCPeerConnection.prototype.getStats = function(selector, onSucc, onErr) {
2363-
return nativeGetStats.apply(this, [selector || null])
2364-
.then(function(stats) {
2365-
return makeMapStats(stats);
2366-
})
2367-
.then(onSucc, onErr);
2368-
};
2362+
var nativeGetStats = RTCPeerConnection.prototype.getStats;
2363+
RTCPeerConnection.prototype.getStats = function(selector, onSucc, onErr) {
2364+
return nativeGetStats.apply(this, [selector || null])
2365+
.then(function(stats) {
2366+
return makeMapStats(stats);
2367+
})
2368+
.then(onSucc, onErr);
2369+
};
2370+
}
23692371
}
23702372
};
23712373

0 commit comments

Comments
 (0)