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

webrtc-test-suite

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webrtc-test-suite - npm Package Compare versions

Comparing version 1.2.11 to 1.2.12

24

dist/index.js
parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"xsGI":[function(require,module,exports) {
"use strict";function e(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;return new Promise(function(t,r){var a=new RTCPeerConnection,i=new RTCPeerConnection,c=a.createDataChannel("sender"),d=Date.now();function o(e){return n?n(!1):r(e)}function s(){var n;if(!e)return!1;(n=console).log.apply(n,arguments)}a.addEventListener("icecandidate",function(e){if(!e.candidate)return!1;s("🚖 First Peer Generated Candidate:",e.candidate),i.addIceCandidate(e.candidate)}),i.addEventListener("icecandidate",function(e){if(!e.candidate)return!1;s("🚖 Second Peer Generated Candidate:",e.candidate),a.addIceCandidate(e.candidate)}),i.addEventListener("datachannel",function(e){e.channel.addEventListener("message",function(e){if(s("✉️ Message Transmission successful"),e.data===d.toString()){if(n)return n(!0);var r=Date.now();return a.close(),i.close(),t(r-d)}o(new Error("message integrity failure"))})}),c.addEventListener("open",function(){return c.send(d.toString())}),a.createOffer().then(function(e){s("🍎 Created RTC Offer"),a.setLocalDescription(e).then(function(){return i.setRemoteDescription(e)}).then(function(){return i.createAnswer().then(function(e){s("🍏 Created RTC Answer"),i.setLocalDescription(e).then(function(){return a.setRemoteDescription(e)}).catch(function(e){return o(e)})}).catch(function(e){return o(e)})})}).catch(function(e){return o(e)})})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var n=e;exports.default=n;
"use strict";function e(e={},n=!1){return new Promise((t,a)=>{let c=new RTCPeerConnection(e),o=new RTCPeerConnection(e),r=c.createDataChannel("sender"),i=Date.now();c.addEventListener("icecandidate",e=>{if(!e.candidate)return!1;n&&console.log("[peer-connection]: First Peer Generated Candidate:",e.candidate),o.addIceCandidate(e.candidate)}),o.addEventListener("icecandidate",e=>{if(!e.candidate)return!1;n&&console.log("[peer-connection]: Second Peer Generated Candidate:",e.candidate),c.addIceCandidate(e.candidate)}),o.addEventListener("datachannel",e=>{e.channel.addEventListener("message",e=>{if(n&&console.log("[peer-connection]: Message Transmission successful"),e.data===i.toString()){let e=Date.now();return c.close(),o.close(),t(e-i)}return a(new Error("message integrity failure"))})}),r.addEventListener("open",()=>r.send(i.toString())),c.createOffer().then(e=>{n&&console.log("[peer-connection]: First peer connection created RTC offer"),c.setLocalDescription(e).then(()=>o.setRemoteDescription(e)).then(()=>o.createAnswer().then(e=>{n&&console.log("[peer-connection]: Seocond peer connection created RTC answer"),o.setLocalDescription(e).then(c.setRemoteDescription(e)).catch(a)}).catch(a))}).catch(a)})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"l4Ib":[function(require,module,exports) {
"use strict";function e(e,i=!1){return new Promise((t,a)=>{if(!e.audio&&!e.video)return a(new Error("Constraints inappropriate"));let r=null;const o=e=>t(e),s=e=>a(e);if(navigator.mediaDevices.getUserMedia?(i&&console.log("[get-user-media]: Using mediaDevices.getUserMedia"),r=navigator.mediaDevices.getUserMedia(e)):navigator.getUserMedia?(i&&console.log("[get-user-media]: Using navigator.getUserMedia"),navigator.getUserMedia(e,o,s),r="getUserMedia"):navigator.webkitGetUserMedia?(i&&console.log("[get-user-media]: Using navigator.webkitGetUserMedia"),navigator.webkitGetUserMedia(e,o,s),r="webkitGetUserMedia"):navigator.mozGetUserMedia&&(i&&console.log("[get-user-media]: Using navigator.mozGetUserMedia"),navigator.mozGetUserMedia(e,o,s),r="mozGetUserMedia"),!r)return a(new Error("No version of getusermedia was found"));r.then&&r.then(t),r.catch&&r.catch(a)})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"plkb":[function(require,module,exports) {
"use strict";function t(t){if(!t)return null;let e=t.getTracks();return Array.prototype.forEach.call(e,t=>t.stop()),e.length}function e(e){try{return t(e)}catch(r){return 0}}Object.defineProperty(exports,"__esModule",{value:!0}),exports.stopMediaStream=t,exports.stopMediaStreamSilent=e;
},{}],"AwD8":[function(require,module,exports) {
"use strict";function e(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{video:!0,audio:!0},t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2?arguments[2]:void 0;return new Promise(function(n,o){function i(e){return r?r(!1):o(e)}function a(){var e;if(!t)return!1;(e=console).log.apply(e,arguments)}navigator.mediaDevices.getUserMedia(e).then(function(t){if(a("🏞 Got Media stream"),t.active){var r=t.getTracks(),o=!1,d=!1,u=[].every.call(r,function(e){return"audio"===e.kind&&(o=!0),"video"===e.kind&&(d=!0),"live"===e.readyState});return r.forEach(function(e){return e.stop()}),u?e.video&&!d?i(new Error("Video Track not found")):e.audio&&!o?i(new Error("Audio Track not found")):n(!0):i(new Error("All requested tracks are not active"))}}).catch(function(e){a("🛑 Failed at getting media stream"),i(e)})})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=e;exports.default=t;
},{}],"S92k":[function(require,module,exports) {
"use strict";function e(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;return new Promise(function(o,r){function c(){var e;if(!t)return!1;(e=console).log.apply(e,arguments)}e||r(new Error("Please provide a filename to download and check internet"));var i=Date.now();c("🧲 Fetching the test file"),fetch("".concat(e,"?rtccheckertimestamp_noconflict=").concat(i)).then(function(e){return e.blob()}).then(function(e){c("😇 Test file fetched successfully");var t=(Date.now()-i)/1e3,r=(8*e.size/t/1048576).toFixed(2);return c("🌎 Internet speed observed during fetch: ".concat(r," Mbps")),n?n(r):o(r)}).catch(function(e){return n?n(!1):r(e)})})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=e;exports.default=t;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=n;var e=a(require("../utils/user_media")),t=o(require("../utils/media_stream_tools"));function r(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return r=function(){return e},e}function o(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=r();if(t&&t.has(e))return t.get(e);var o={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var i=a?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(o,n,i):o[n]=e[n]}return o.default=e,t&&t.set(e,o),o}function a(e){return e&&e.__esModule?e:{default:e}}function n(r,o=!1,a=!1){return new Promise((n,i)=>{if(!r.audio&&!r.video)return i(new Error("Constraints are not correct"));o&&console.log("[media-capture]: Requesting user media"),(0,e.default)(r,o).then(e=>{if(o&&console.log("[media-capture]: Received media Stream"),e.active){let d=e.getTracks();var u=!1,c=!1;let l=[].every.call(d,e=>("audio"===e.kind&&(u=!0),"video"===e.kind&&(c=!0),"live"===e.readyState));return o&&console.log("[media-capture]: Received ".concat(d.length," track(s)")),l?r.video&&!c?(t.stopMediaStream(e),i(new Error("Video Track not found"))):r.audio&&!u?(t.stopMediaStream(e),i(new Error("Audio Track not found"))):(a||(o&&console.log("[media-capture]: Stopping media track(s)"),t.stopMediaStream(e)),n(!a||e)):(t.stopMediaStream(e),i(new Error("All requested tracks are not active")))}}).catch(i)})}
},{"../utils/user_media":"l4Ib","../utils/media_stream_tools":"plkb"}],"S92k":[function(require,module,exports) {
"use strict";function e(e,t=!1){return new Promise((n,o)=>{if(!e)return o(new Error("Please provide a filename to download and check internet"));if("function"!=typeof fetch)return o(new Error("Fetch API support is required for this check"));t&&console.log("[internet-connection]: Will fetch the check file");let c=Date.now(),r=/\?/.test(e)?"&":"?";fetch("".concat(e).concat(r,"rtccheckertimestamp_noconflict=").concat(c)).then(e=>200!==e.status?o(new Error("Error loading the checker file")):e.blob()).then(e=>{t&&console.log("[internet-connection]: Fetched the checker file");let o=(Date.now()-c)/1e3,r=(8*e.size/o/1048576).toFixed(2);return t&&console.log("[internet-connection]: Speed observed: ".concat(r,"mbps")),n(r)}).catch(o)})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"Ah8h":[function(require,module,exports) {
"use strict";function e(e=!1){return new Promise((o,t)=>{let i={audio:{in:0,out:0},video:{in:0,out:0},unknown:0};e&&console.log("[count-devices]: Requesting device list"),navigator.mediaDevices.enumerateDevices().then(t=>(e&&console.log("[count-devices]: Received device list. Total devices: ".concat(t.length)),Array.prototype.forEach.call(t,e=>{switch(e.kind){case"audioinput":i.audio.in++;break;case"audiooutput":i.audio.out++;break;case"videoinput":i.video.in++;break;case"videooutput":i.video.out++;break;default:i.unknown++}}),o(i))).catch(t)})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"rsdb":[function(require,module,exports) {
"use strict";function e(e=!1){let i={video:{basic:!1},audio:{basic:!1,webAudio:!1},rtcPeerConnection:!1,rtcDataChannel:!1,getUserMedia:!1,getDisplayMedia:!1};if(e&&console.log("[feature-test] Checking for video availability"),"function"==typeof document.createElement("video").play&&(i.video.basic=!0),e&&console.log("[feature-test] Checking for audio availability"),"function"==typeof document.createElement("audio").play&&(i.audio.basic=!0),e&&console.log("[feature-test] Checking for web-audio API availability"),"AudioContext"in window?i.audio.webAudio=!0:"webkitAudioContext"in window&&(i.audio.webAudio="prefix-webkit"),e&&console.log("[feature-test] Checking for getUserMedia"),navigator&&"mediaDevices"in navigator&&"getUserMedia"in navigator.mediaDevices?i.getUserMedia=!0:navigator&&"getUserMedia"in navigator?i.getUserMedia="old":"webkitGetUserMedia"in navigator?i.getUserMedia="prefix-webkit":"mozGetUserMedia"in navigator&&(i.getUserMedia="prefix-moz"),navigator&&"mediaDevices"in navigator&&"getDisplayMedia"in navigator.mediaDevices&&(i.getDisplayMedia=!0),e&&console.log("[feature-test] Checking for rtcPeerConnection"),"RTCPeerConnection"in window&&(i.rtcPeerConnection=!0),i.rtcPeerConnection){e&&console.log("[feature-test] Checking for RTC Data Channel"),"createDataChannel"in new RTCPeerConnection&&(i.rtcDataChannel=!0)}else i.rtcDataChannel=!1;return i}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"b0V7":[function(require,module,exports) {
"use strict";function e(e){return new Promise(t=>{try{e.then(e=>t(e)).catch(()=>t(null))}catch(r){t(null)}})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"m4iV":[function(require,module,exports) {
function r(r,e){return r&&e?(void 0!==r.srcObject?r.srcObject=e:r.src=window.URL.createObjectURL(e),r):null}function e(r){return r?(void 0!==r.srcObject?r.srcObject=null:r.src="",r):null}module.exports={addStreamToDOM:r,removeStreamFromDOM:e};
},{}],"Focm":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=n(require("./checks/peerConnection")),t=n(require("./checks/mediaCapture")),r=n(require("./checks/internet"));function n(e){return e&&e.__esModule?e:{default:e}}var u={checkPeerConnection:e.default,checkMediaCapture:t.default,checkInternetSpeed:r.default};"undefined"!=typeof window&&(window._RTCTest=u);var c=u;exports.default=c;
},{"./checks/peerConnection":"xsGI","./checks/mediaCapture":"AwD8","./checks/internet":"S92k"}]},{},["Focm"], null)
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=f(require("./checks/peerConnection")),t=f(require("./checks/mediaCapture")),r=f(require("./checks/internet")),u=f(require("./checks/count_devices")),i=f(require("./checks/feature_support")),n=f(require("./utils/simplify_promise")),a=d(require("./utils/dom_tag_tools")),c=f(require("./utils/user_media")),l=d(require("./utils/media_stream_tools"));function o(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return o=function(){return e},e}function d(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=o();if(t&&t.has(e))return t.get(e);var r={},u=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=u?Object.getOwnPropertyDescriptor(e,i):null;n&&(n.get||n.set)?Object.defineProperty(r,i,n):r[i]=e[i]}return r.default=e,t&&t.set(e,r),r}function f(e){return e&&e.__esModule?e:{default:e}}let s={checkPeerConnection:e.default,checkMediaCapture:t.default,checkInternetSpeed:r.default,countDevies:u.default,getUserMedia:c.default,checkFeatureSupport:i.default,checkPeerConnectionSilent:(t={},r=!1)=>(0,n.default)((0,e.default)(t,r)),checkMediaCaptureSilent:(e,r=!1,u=!1)=>(0,n.default)((0,t.default)(e,r,u)),checkInternetSpeedSilent:(e,t=!1)=>(0,n.default)((0,r.default)(e,t)),countDeviesSilent:(e=!1)=>(0,n.default)((0,u.default)(e)),getUserMediaSilent:(e,t=!1)=>(0,n.default)((0,c.default)(e,t)),utils:{flat:n.default,dom:a,stream:l}};"undefined"!=typeof window&&(window._rtc=s);var p=s;exports.default=p;
},{"./checks/peerConnection":"xsGI","./checks/mediaCapture":"AwD8","./checks/internet":"S92k","./checks/count_devices":"Ah8h","./checks/feature_support":"rsdb","./utils/simplify_promise":"b0V7","./utils/dom_tag_tools":"m4iV","./utils/user_media":"l4Ib","./utils/media_stream_tools":"plkb"}]},{},["Focm"], null)
//# sourceMappingURL=/index.js.map
{
"name": "webrtc-test-suite",
"version": "1.2.11",
"version": "1.2.12",
"main": "index.js",

@@ -5,0 +5,0 @@ "repository": "git@github.com:theanam/webrtc-test-suite.git",

@@ -29,3 +29,3 @@ # Real life Capability testing and utilities for WebRTC.

```html
<script src="https://unpkg.com/webrtc-test-suite@1.2.11/dist/index.js"></script>
<script src="https://unpkg.com/webrtc-test-suite@1.2.12/dist/index.js"></script>
```

@@ -32,0 +32,0 @@ Yoou will get a global object called: `_rtc`. And you can access all the functionalities from that object.

Sorry, the diff of this file is not supported yet

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