Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@webex/rtcstats

Package Overview
Dependencies
Maintainers
7
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webex/rtcstats - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

145

dist/rtcstats.js

@@ -64,2 +64,13 @@ "use strict";

};
var dumpStream = function (stream) { return ({
id: stream.id,
tracks: stream.getTracks().map(function (track) { return ({
id: track.id,
kind: track.kind,
label: track.label,
enabled: track.enabled,
muted: track.muted,
readyState: track.readyState
}); })
}); };
var persistedKeys = ['type', 'id', 'timestamp'];

@@ -159,2 +170,3 @@ /**

};
var origPeerConnection = window.RTCPeerConnection;
pc.addEventListener('icecandidate', function (e) {

@@ -192,2 +204,135 @@ if (e.candidate) {

});
['createDataChannel', 'close'].forEach(function (method) {
var nativeMethod = origPeerConnection.prototype[method];
if (nativeMethod) {
origPeerConnection.prototype[method] = function () {
trace(method, makeEvent(method));
return nativeMethod.apply(this, arguments);
};
}
});
['addStream', 'removeStream'].forEach(function (method) {
var nativeMethod = origPeerConnection.prototype[method];
if (nativeMethod) {
origPeerConnection.prototype[method] = function () {
var stream = arguments[0];
var streamInfo = stream
.getTracks()
.map(function (t) { return "".concat(t.kind, ":").concat(t.id); })
.join(',');
trace(method, makeEvent("".concat(stream.id, " ").concat(streamInfo)));
return nativeMethod.apply(this, arguments);
};
}
});
['addTrack'].forEach(function (method) {
var nativeMethod = origPeerConnection.prototype[method];
if (nativeMethod) {
origPeerConnection.prototype[method] = function () {
var track = arguments[0];
var streams = [].slice.call(arguments, 1);
trace(method, makeEvent("".concat(track.kind, ":").concat(track.id, " ").concat(streams.map(function (s) { return "stream:".concat(s.id); }).join(';') || '-')));
return nativeMethod.apply(this, arguments);
};
}
});
['removeTrack'].forEach(function (method) {
var nativeMethod = origPeerConnection.prototype[method];
if (nativeMethod) {
origPeerConnection.prototype[method] = function () {
var track = arguments[0].track;
trace(method, makeEvent(track ? "".concat(track.kind, ":").concat(track.id) : 'null'));
return nativeMethod.apply(this, arguments);
};
}
});
['createOffer', 'createAnswer'].forEach(function (method) {
var nativeMethod = origPeerConnection.prototype[method];
if (nativeMethod) {
origPeerConnection.prototype[method] = function () {
var opts;
var args = arguments;
if (arguments.length === 1 && typeof arguments[0] === 'object') {
// eslint-disable-next-line prefer-destructuring
opts = arguments[0];
}
else if (arguments.length === 3 && typeof arguments[2] === 'object') {
// eslint-disable-next-line prefer-destructuring
opts = arguments[2];
}
trace(method, makeEvent(opts || ''));
return nativeMethod.apply(this, opts ? [opts] : undefined).then(function (description) {
trace("".concat(method, "OnSuccess"), makeEvent(description.sdp));
if (args.length > 0 && typeof args[0] === 'function') {
args[0].apply(null, [description]);
return undefined;
}
return description;
}, function (err) {
trace("".concat(method, "OnFailure"), makeEvent(err.toString()));
if (args.length > 1 && typeof args[1] === 'function') {
args[1].apply(null, [err]);
return;
}
throw err;
});
};
}
});
['setLocalDescription', 'setRemoteDescription', 'addIceCandidate'].forEach(function (method) {
var nativeMethod = origPeerConnection.prototype[method];
if (nativeMethod) {
origPeerConnection.prototype[method] = function () {
var args = arguments;
trace(method, makeEvent(method === 'addIceCandidate' ? arguments[0] : arguments[0].sdp));
return nativeMethod.apply(this, [arguments[0]]).then(function () {
trace("".concat(method, "OnSuccess"), makeEvent('success'));
if (args.length >= 2 && typeof args[1] === 'function') {
args[1].apply(null, []);
return undefined;
}
return undefined;
}, function (err) {
trace("".concat(method, "OnFailure"), makeEvent(err.toString()));
if (args.length >= 3 && typeof args[2] === 'function') {
args[2].apply(null, [err]);
return undefined;
}
throw err;
});
};
}
});
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
var origGetUserMedia_1 = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices);
var gum = function () {
trace('navigator.mediaDevices.getUserMedia', makeEvent(JSON.stringify(arguments[0])));
return origGetUserMedia_1
.apply(navigator.mediaDevices, arguments)
.then(function (stream) {
trace('navigator.mediaDevices.getUserMediaOnSuccess', makeEvent(JSON.stringify(dumpStream(stream))));
return stream;
}, function (err) {
trace('navigator.mediaDevices.getUserMediaOnFailure', makeEvent(err.name));
return Promise.reject(err);
});
};
navigator.mediaDevices.getUserMedia = gum.bind(navigator.mediaDevices);
}
if (navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
var origGetDisplayMedia_1 = navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices);
var gdm = function () {
trace('navigator.mediaDevices.getDisplayMedia', makeEvent(JSON.stringify(arguments[0])));
return origGetDisplayMedia_1
.apply(navigator.mediaDevices, arguments)
.then(function (stream) {
trace('navigator.mediaDevices.getDisplayMediaOnSuccess', makeEvent(JSON.stringify(dumpStream(stream))));
return stream;
}, function (err) {
trace('navigator.mediaDevices.getDisplayMediaOnFailure', makeEvent(err.name));
return Promise.reject(err);
});
};
navigator.mediaDevices.getDisplayMedia = gdm.bind(navigator.mediaDevices);
}
var interval = window.setInterval(function () {

@@ -194,0 +339,0 @@ if (pc.signalingState === 'closed') {

2

package.json
{
"name": "@webex/rtcstats",
"version": "1.0.2",
"version": "1.1.0",
"main": "dist/rtcstats.js",

@@ -5,0 +5,0 @@ "types": "dist/rtcstats.d.ts",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc