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

webrtc-browser-test

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webrtc-browser-test - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

4

lib/webrtc-browser-test.js

@@ -105,2 +105,4 @@ 'use strict';

throw new VideoDeniedError();
} else if (err.name === 'PermissionDeniedError') {
throw new VideoDeniedError();
} else {

@@ -123,2 +125,4 @@ throw err;

throw new AudioDeniedError();
} else if (err.name === 'PermissionDeniedError') {
throw new AudioDeniedError();
} else {

@@ -125,0 +129,0 @@ throw err;

2

lib/webrtc-browser-test.min.js

@@ -1,1 +0,1 @@

"use strict";!function(){var e=function(e){this.name="ParameterError",this.message=e||""};e.prototype=Error.prototype;var t=function(e){this.name="BrowserNotSupportedError",this.message=e||""};t.prototype=Error.prototype;var r=function(e){this.name="VideoNotFoundError",this.message=e||"Unable to detect a video camera. Please ensure you've installed and tested your webcam."};r.prototype=Error.prototype;var o=function(e){this.name="VideoDeniedError",this.message=e||"Your browser is preventing access to your camera and microphone. Please check your browser settings (usually an icon in the address bar) to enable access."};o.prototype=Error.prototype;var n=function(e){this.name="AudioNotFoundError",this.message=e||"Unable to detect a microphone. Usually your video camera will have an integrated microphone, but if not please attach and enable one."};n.prototype=Error.prototype;var a=function(e){this.name="AudioDeniedError",this.message=e||"Your browser is preventing access to your microphone. Please check your browser settings (usually an icon in the address bar) to enable access."};a.prototype=Error.prototype;var i=function(i){if("string"==typeof i.mediaElementContainer&&(i.mediaElementContainer=document.querySelector(i.mediaElementContainer)),!(i.mediaElementContainer&&i.mediaElementContainer instanceof Element))throw new e("Missing required element parameter. Tests can't continue.");if(i.onVolumeChange&&"function"!=typeof i.onVolumeChange)throw new e("Volume callback parameter must be a function. Tests can't continue.");if(!window.Promise)throw new t("Your browser doesn't support Promises. Tests can't continue.");var s=document.querySelector("#videoContainer > video");s||(s=document.createElement("video"),s.setAttribute("autoplay",!0),i.mediaElementContainer.appendChild(s));var u=document.querySelector("#videoContainer > audio");u||(u=document.createElement("audio"),u.setAttribute("autoplay",!0),i.mediaElementContainer.appendChild(u));var c=function(e){return navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia(e):navigator.getUserMedia?new Promise(function(t,r){navigator.getUserMedia(e,t,r)}):navigator.mozGetUserMedia?new Promise(function(t,r){navigator.mozGetUserMedia(e,t,r)}):navigator.webkitGetUserMedia?new Promise(function(t,r){navigator.webkitGetUserMedia(e,t,r)}):void 0},d=function(){return navigator.mediaDevices&&navigator.mediaDevices.getUserMedia||navigator.getUserMedia||navigator.mozGetUserMedia||navigator.webkitGetUserMedia?Promise.resolve():Promise.reject(new t("Your browser doesn't support WebRTC."))},m=function(){return d().then(function(){return c({video:!0}).then(function(e){return s.srcObject=e,Promise.resolve()}).catch(function(e){throw"NotFoundError"===e.name?new r:"NotAllowedError"===e.name?new o:e})})},l=function(){return d().then(function(){return c({audio:!0}).then(function(e){return u.srcObject=e,v(e)}).catch(function(e){throw"NotFoundError"===e.name?new n:"NotAllowedError"===e.name?new a:e})})},p=function(e,t){var r=e.createScriptProcessor(2048,1,1);r.connect(e.destination);var o=null;return r.onaudioprocess=function(e){for(var r=e.inputBuffer.getChannelData(0),n=0,a=0;n<r.length;)a+=Math.abs(r[n++]);var i=Math.sqrt(a/r.length);o=null===o||o<i?i:.7*o+.3*i;var s=Math.log(o)/Math.LN10/1.5+1;s=Math.min(Math.max(s,0),1),t&&t(s)},r},v=function(e){var r=void 0;try{window.AudioContext=window.AudioContext||window.webkitAudioContext,r=new AudioContext}catch(e){return Promise.reject(new t("Your browser doesn't support web audio."))}var o=p(r,i.onVolumeChange);try{return r.createMediaStreamSource(e).connect(o),Promise.resolve()}catch(e){return Promise.reject(e)}};return{checkBrowser:d,startVideo:m,startAudio:l,startAll:function(){return d().then(function(){return m()}).then(function(){return l()})}}};"undefined"==typeof module||void 0===module.exports?window.WebRtcBrowserTest=i:module.exports=i}();
"use strict";!function(){var e=function(e){this.name="ParameterError",this.message=e||""};e.prototype=Error.prototype;var t=function(e){this.name="BrowserNotSupportedError",this.message=e||""};t.prototype=Error.prototype;var r=function(e){this.name="VideoNotFoundError",this.message=e||"Unable to detect a video camera. Please ensure you've installed and tested your webcam."};r.prototype=Error.prototype;var o=function(e){this.name="VideoDeniedError",this.message=e||"Your browser is preventing access to your camera and microphone. Please check your browser settings (usually an icon in the address bar) to enable access."};o.prototype=Error.prototype;var n=function(e){this.name="AudioNotFoundError",this.message=e||"Unable to detect a microphone. Usually your video camera will have an integrated microphone, but if not please attach and enable one."};n.prototype=Error.prototype;var a=function(e){this.name="AudioDeniedError",this.message=e||"Your browser is preventing access to your microphone. Please check your browser settings (usually an icon in the address bar) to enable access."};a.prototype=Error.prototype;var i=function(i){if("string"==typeof i.mediaElementContainer&&(i.mediaElementContainer=document.querySelector(i.mediaElementContainer)),!(i.mediaElementContainer&&i.mediaElementContainer instanceof Element))throw new e("Missing required element parameter. Tests can't continue.");if(i.onVolumeChange&&"function"!=typeof i.onVolumeChange)throw new e("Volume callback parameter must be a function. Tests can't continue.");if(!window.Promise)throw new t("Your browser doesn't support Promises. Tests can't continue.");var s=document.querySelector("#videoContainer > video");s||(s=document.createElement("video"),s.setAttribute("autoplay",!0),i.mediaElementContainer.appendChild(s));var u=document.querySelector("#videoContainer > audio");u||(u=document.createElement("audio"),u.setAttribute("autoplay",!0),i.mediaElementContainer.appendChild(u));var c=function(e){return navigator.mediaDevices&&navigator.mediaDevices.getUserMedia?navigator.mediaDevices.getUserMedia(e):navigator.getUserMedia?new Promise(function(t,r){navigator.getUserMedia(e,t,r)}):navigator.mozGetUserMedia?new Promise(function(t,r){navigator.mozGetUserMedia(e,t,r)}):navigator.webkitGetUserMedia?new Promise(function(t,r){navigator.webkitGetUserMedia(e,t,r)}):void 0},d=function(){return navigator.mediaDevices&&navigator.mediaDevices.getUserMedia||navigator.getUserMedia||navigator.mozGetUserMedia||navigator.webkitGetUserMedia?Promise.resolve():Promise.reject(new t("Your browser doesn't support WebRTC."))},m=function(){return d().then(function(){return c({video:!0}).then(function(e){return s.srcObject=e,Promise.resolve()}).catch(function(e){throw"NotFoundError"===e.name?new r:"NotAllowedError"===e.name?new o:"PermissionDeniedError"===e.name?new o:e})})},l=function(){return d().then(function(){return c({audio:!0}).then(function(e){return u.srcObject=e,v(e)}).catch(function(e){throw"NotFoundError"===e.name?new n:"NotAllowedError"===e.name?new a:"PermissionDeniedError"===e.name?new a:e})})},p=function(e,t){var r=e.createScriptProcessor(2048,1,1);r.connect(e.destination);var o=null;return r.onaudioprocess=function(e){for(var r=e.inputBuffer.getChannelData(0),n=0,a=0;n<r.length;)a+=Math.abs(r[n++]);var i=Math.sqrt(a/r.length);o=null===o||o<i?i:.7*o+.3*i;var s=Math.log(o)/Math.LN10/1.5+1;s=Math.min(Math.max(s,0),1),t&&t(s)},r},v=function(e){var r=void 0;try{window.AudioContext=window.AudioContext||window.webkitAudioContext,r=new AudioContext}catch(e){return Promise.reject(new t("Your browser doesn't support web audio."))}var o=p(r,i.onVolumeChange);try{return r.createMediaStreamSource(e).connect(o),Promise.resolve()}catch(e){return Promise.reject(e)}};return{checkBrowser:d,startVideo:m,startAudio:l,startAll:function(){return d().then(function(){return m()}).then(function(){return l()})}}};"undefined"==typeof module||void 0===module.exports?window.WebRtcBrowserTest=i:module.exports=i}();
{
"name": "webrtc-browser-test",
"version": "1.0.0",
"version": "1.1.0",
"description": "Test video and audio capabilities of the browser, verifying hardware works properly.",

@@ -5,0 +5,0 @@ "main": "lib/webrtc-browser-test.js",

@@ -108,2 +108,4 @@ (function() {

throw new VideoDeniedError();
} else if (err.name === 'PermissionDeniedError') {
throw new VideoDeniedError();
} else {

@@ -126,2 +128,4 @@ throw err;

throw new AudioDeniedError();
} else if (err.name === 'PermissionDeniedError') {
throw new AudioDeniedError();
} else {

@@ -128,0 +132,0 @@ throw err;

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