| (function() {
|
| 'use strict';
|
|
|
|
|
| const OriginalRTC = window.RTCPeerConnection || window.webkitRTCPeerConnection || window.mozRTCPeerConnection;
|
| if (!OriginalRTC) return;
|
|
|
| window.RTCPeerConnection = function(config, constraints) {
|
| if (config && config.iceServers) {
|
| config.iceServers = config.iceServers.filter(server => {
|
| const urls = Array.isArray(server.urls) ? server.urls : [server.urls || server.url];
|
| return !urls.some(u => u && u.toString().startsWith('stun:'));
|
| });
|
| }
|
| return new OriginalRTC(config, constraints);
|
| };
|
|
|
| window.RTCPeerConnection.prototype = OriginalRTC.prototype;
|
| Object.setPrototypeOf(window.RTCPeerConnection, OriginalRTC);
|
|
|
| if (window.webkitRTCPeerConnection) {
|
| window.webkitRTCPeerConnection = window.RTCPeerConnection;
|
| }
|
| })();
|
|
|