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

detectrtc

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detectrtc - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

29

DetectRTC.js

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

// Last time updated at May 28, 2015, 08:32:23
// Last time updated at August 17, 2015, 08:32:23

@@ -65,5 +65,5 @@ // Latest file can be found here: https://cdn.webrtc-experiment.com/DetectRTC.js

browser: browser,
hasMicrophone: navigator.getMediaDevices || navigator.enumerateDevices ? false : 'unable to detect',
hasSpeakers: navigator.getMediaDevices || navigator.enumerateDevices ? false : 'unable to detect',
hasWebcam: navigator.getMediaDevices || navigator.enumerateDevices ? false : 'unable to detect',
hasMicrophone: navigator.enumerateDevices ? false : 'unable to detect',
hasSpeakers: navigator.enumerateDevices ? false : 'unable to detect',
hasWebcam: navigator.enumerateDevices ? false : 'unable to detect',

@@ -149,6 +149,2 @@ isWebRTCSupported: !!window.webkitRTCPeerConnection || !!window.mozRTCPeerConnection,

if (!navigator.getMediaDevices) {
warn('navigator.getMediaDevices API are not available.');
}
if (!navigator.enumerateDevices) {

@@ -158,3 +154,3 @@ warn('navigator.enumerateDevices API are not available.');

if (!window.MediaStreamTrack || !window.MediaStreamTrack.getSources) {
if (!navigator.enumerateDevices && (!window.MediaStreamTrack || !window.MediaStreamTrack.getSources)) {
warn('MediaStreamTrack.getSources are not available.');

@@ -168,13 +164,12 @@ }

if (!navigator.getMediaDevices && window.MediaStreamTrack && window.MediaStreamTrack.getSources) {
navigator.getMediaDevices = window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack);
if (!navigator.enumerateDevices && window.MediaStreamTrack && window.MediaStreamTrack.getSources) {
navigator.enumerateDevices = window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack);
}
if (!navigator.getMediaDevices && navigator.enumerateDevices) {
navigator.getMediaDevices = navigator.enumerateDevices.bind(navigator);
if (!navigator.enumerateDevices && navigator.enumerateDevices) {
navigator.enumerateDevices = navigator.enumerateDevices.bind(navigator);
}
// if still no 'getMediaDevices'; it MUST be Firefox!
if (!navigator.getMediaDevices) {
warn('navigator.getMediaDevices is undefined.');
if (!navigator.enumerateDevices) {
warn('navigator.enumerateDevices is undefined.');
// assuming that it is older chrome or chromium implementation

@@ -194,3 +189,3 @@ if (isChrome) {

DetectRTC.MediaDevices = [];
navigator.getMediaDevices(function(devices) {
navigator.enumerateDevices(function(devices) {
devices.forEach(function(_device) {

@@ -197,0 +192,0 @@ var device = {};

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

!function(){"use strict";function warn(log){window.console&&"undefined"!=typeof window.console.warn&&console.warn(log)}function CheckDeviceSupport(callback){return!navigator.getMediaDevices&&window.MediaStreamTrack&&window.MediaStreamTrack.getSources&&(navigator.getMediaDevices=window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack)),!navigator.getMediaDevices&&navigator.enumerateDevices&&(navigator.getMediaDevices=navigator.enumerateDevices.bind(navigator)),navigator.getMediaDevices?(DetectRTC.MediaDevices=[],void navigator.getMediaDevices(function(devices){devices.forEach(function(_device){var device={};for(var d in _device)device[d]=_device[d];var skip;DetectRTC.MediaDevices.forEach(function(d){d.id===device.id&&(skip=!0)}),skip||("audio"===device.kind&&(device.kind="audioinput"),"video"===device.kind&&(device.kind="videoinput"),device.deviceId||(device.deviceId=device.id),device.id||(device.id=device.deviceId),device.label||(device.label="Please invoke getUserMedia once."),("audioinput"===device.kind||"audio"===device.kind)&&(DetectRTC.hasMicrophone=!0),"audiooutput"===device.kind&&(DetectRTC.hasSpeakers=!0),("videoinput"===device.kind||"video"===device.kind)&&(DetectRTC.hasWebcam=!0),DetectRTC.MediaDevices.push(device))}),callback&&callback()})):(warn("navigator.getMediaDevices is undefined."),isChrome&&(DetectRTC.hasMicrophone=!0,DetectRTC.hasSpeakers=!0,DetectRTC.hasWebcam=!0),void(callback&&callback()))}function getBrowserInfo(){var nameOffset,verOffset,ix,nAgt=(navigator.appVersion,navigator.userAgent),browserName=navigator.appName,fullVersion=""+parseFloat(navigator.appVersion),majorVersion=parseInt(navigator.appVersion,10);return-1!==(verOffset=nAgt.indexOf("Opera"))?(browserName="Opera",fullVersion=nAgt.substring(verOffset+6),-1!==(verOffset=nAgt.indexOf("Version"))&&(fullVersion=nAgt.substring(verOffset+8))):-1!==(verOffset=nAgt.indexOf("MSIE"))?(browserName="IE",fullVersion=nAgt.substring(verOffset+5)):-1!==(verOffset=nAgt.indexOf("Chrome"))?(browserName="Chrome",fullVersion=nAgt.substring(verOffset+7)):-1!==(verOffset=nAgt.indexOf("Safari"))?(browserName="Safari",fullVersion=nAgt.substring(verOffset+7),-1!==(verOffset=nAgt.indexOf("Version"))&&(fullVersion=nAgt.substring(verOffset+8))):-1!==(verOffset=nAgt.indexOf("Firefox"))?(browserName="Firefox",fullVersion=nAgt.substring(verOffset+8)):(nameOffset=nAgt.lastIndexOf(" ")+1)<(verOffset=nAgt.lastIndexOf("/"))&&(browserName=nAgt.substring(nameOffset,verOffset),fullVersion=nAgt.substring(verOffset+1),browserName.toLowerCase()===browserName.toUpperCase()&&(browserName=navigator.appName)),-1!==(ix=fullVersion.indexOf(";"))&&(fullVersion=fullVersion.substring(0,ix)),-1!==(ix=fullVersion.indexOf(" "))&&(fullVersion=fullVersion.substring(0,ix)),majorVersion=parseInt(""+fullVersion,10),isNaN(majorVersion)&&(fullVersion=""+parseFloat(navigator.appVersion),majorVersion=parseInt(navigator.appVersion,10)),{fullVersion:fullVersion,version:majorVersion,name:browserName}}function getIPs(callback){function handleCandidate(candidate){var ipRegex=/([0-9]{1,3}(\.[0-9]{1,3}){3})/,ipAddress=ipRegex.exec(candidate)[1];void 0===ipDuplicates[ipAddress]&&callback(ipAddress),ipDuplicates[ipAddress]=!0}var ipDuplicates={},RTCPeerConnection=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,useWebKit=!!window.webkitRTCPeerConnection;if(!RTCPeerConnection){var iframe=document.getElementById("iframe");if(!iframe)throw"NOTE: you need to have an iframe in the page right above the script tag.";var win=iframe.contentWindow;RTCPeerConnection=win.RTCPeerConnection||win.mozRTCPeerConnection||win.webkitRTCPeerConnection,useWebKit=!!win.webkitRTCPeerConnection}var servers,mediaConstraints={optional:[{RtpDataChannels:!0}]};useWebKit&&(servers={iceServers:[{urls:"stun:stun.services.mozilla.com"}]});var pc=new RTCPeerConnection(servers,mediaConstraints);pc.onicecandidate=function(ice){ice.candidate&&handleCandidate(ice.candidate.candidate)},pc.createDataChannel(""),pc.createOffer(function(result){pc.setLocalDescription(result,function(){},function(){})},function(){}),setTimeout(function(){var lines=pc.localDescription.sdp.split("\n");lines.forEach(function(line){0===line.indexOf("a=candidate:")&&handleCandidate(line)})},1e3)}var browser=getBrowserInfo(),isOpera=!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0,isFirefox="undefined"!=typeof InstallTrigger,isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,isChrome=!!window.chrome&&!isOpera,isIE=!!document.documentMode,isMobileDevice=!!navigator.userAgent.match(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile/i),isNodeWebkit=!!(window.process&&"object"==typeof window.process&&window.process.versions&&window.process.versions["node-webkit"]),isHTTPs="https:"===location.protocol;navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices&&(navigator.enumerateDevices=function(callback){navigator.mediaDevices.enumerateDevices().then(callback)}),window.DetectRTC={browser:browser,hasMicrophone:navigator.getMediaDevices||navigator.enumerateDevices?!1:"unable to detect",hasSpeakers:navigator.getMediaDevices||navigator.enumerateDevices?!1:"unable to detect",hasWebcam:navigator.getMediaDevices||navigator.enumerateDevices?!1:"unable to detect",isWebRTCSupported:!!window.webkitRTCPeerConnection||!!window.mozRTCPeerConnection,isAudioContextSupported:!!window.AudioContext&&!!window.AudioContext.prototype.createMediaStreamSource||!!window.webkitAudioContext&&!!window.webkitAudioContext.prototype.createMediaStreamSource,isScreenCapturingSupported:isFirefox&&browser.version>=33||isChrome&&browser.version>=26&&(isNodeWebkit?!0:"https:"===location.protocol),isDesktopCapturingSupported:isHTTPs&&(isFirefox&&browser.version>=33||isChrome&&browser.version>=34||isNodeWebkit||!1),isSctpDataChannelsSupported:isFirefox||isChrome&&browser.version>=25,isRtpDataChannelsSupported:isChrome&&browser.version>=31,isMobileDevice:!!navigator.userAgent.match(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile/i),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING,isCanvasCaptureStreamSupported:!1,isVideoCaptureStreamSupported:!1},function(){var canvas=document.createElement("canvas");"function"==typeof canvas.captureStream?DetectRTC.isCanvasCaptureStreamSupported=!0:"function"==typeof canvas.mozCaptureStream?DetectRTC.isCanvasCaptureStreamSupported=!0:"function"==typeof canvas.webkitCaptureStream&&(DetectRTC.isCanvasCaptureStreamSupported=!0)}(),function(){var video=document.createElement("video");"function"==typeof video.captureStream?DetectRTC.isVideoCaptureStreamSupported=!0:"function"==typeof video.mozCaptureStream?DetectRTC.isVideoCaptureStreamSupported=!0:"function"==typeof video.webkitCaptureStream&&(DetectRTC.isVideoCaptureStreamSupported=!0)}(),isHTTPs||(window.DetectRTC.isScreenCapturingSupported=window.DetectRTC.isDesktopCapturingSupported="Requires HTTPs."),DetectRTC.browser={isFirefox:isFirefox,isChrome:isChrome,isMobileDevice:isMobileDevice,isNodeWebkit:isNodeWebkit,isSafari:isSafari,isIE:isIE,isOpera:isOpera,name:browser.name,version:browser.version};var osName="Unknown OS";-1!==navigator.appVersion.indexOf("Win")&&(osName="Windows"),-1!==navigator.appVersion.indexOf("Mac")&&(osName="MacOS"),-1!==navigator.appVersion.indexOf("X11")&&(osName="UNIX"),-1!==navigator.appVersion.indexOf("Linux")&&(osName="Linux"),DetectRTC.osName=osName,DetectRTC.MediaDevices=[],navigator.getMediaDevices||warn("navigator.getMediaDevices API are not available."),navigator.enumerateDevices||warn("navigator.enumerateDevices API are not available."),window.MediaStreamTrack&&window.MediaStreamTrack.getSources||warn("MediaStreamTrack.getSources are not available."),new CheckDeviceSupport,DetectRTC.load=CheckDeviceSupport,DetectRTC.DetectLocalIPAddress=function(callback){getIPs(function(ip){callback(ip.match(/^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/)?"Local: "+ip:"Public: "+ip)})}}();
!function(){"use strict";function warn(log){window.console&&"undefined"!=typeof window.console.warn&&console.warn(log)}function CheckDeviceSupport(callback){return!navigator.enumerateDevices&&window.MediaStreamTrack&&window.MediaStreamTrack.getSources&&(navigator.enumerateDevices=window.MediaStreamTrack.getSources.bind(window.MediaStreamTrack)),!navigator.enumerateDevices&&navigator.enumerateDevices&&(navigator.enumerateDevices=navigator.enumerateDevices.bind(navigator)),navigator.enumerateDevices?(DetectRTC.MediaDevices=[],void navigator.enumerateDevices(function(devices){devices.forEach(function(_device){var device={};for(var d in _device)device[d]=_device[d];var skip;DetectRTC.MediaDevices.forEach(function(d){d.id===device.id&&(skip=!0)}),skip||("audio"===device.kind&&(device.kind="audioinput"),"video"===device.kind&&(device.kind="videoinput"),device.deviceId||(device.deviceId=device.id),device.id||(device.id=device.deviceId),device.label||(device.label="Please invoke getUserMedia once."),("audioinput"===device.kind||"audio"===device.kind)&&(DetectRTC.hasMicrophone=!0),"audiooutput"===device.kind&&(DetectRTC.hasSpeakers=!0),("videoinput"===device.kind||"video"===device.kind)&&(DetectRTC.hasWebcam=!0),DetectRTC.MediaDevices.push(device))}),callback&&callback()})):(warn("navigator.enumerateDevices is undefined."),isChrome&&(DetectRTC.hasMicrophone=!0,DetectRTC.hasSpeakers=!0,DetectRTC.hasWebcam=!0),void(callback&&callback()))}function getBrowserInfo(){var nameOffset,verOffset,ix,nAgt=(navigator.appVersion,navigator.userAgent),browserName=navigator.appName,fullVersion=""+parseFloat(navigator.appVersion),majorVersion=parseInt(navigator.appVersion,10);return-1!==(verOffset=nAgt.indexOf("Opera"))?(browserName="Opera",fullVersion=nAgt.substring(verOffset+6),-1!==(verOffset=nAgt.indexOf("Version"))&&(fullVersion=nAgt.substring(verOffset+8))):-1!==(verOffset=nAgt.indexOf("MSIE"))?(browserName="IE",fullVersion=nAgt.substring(verOffset+5)):-1!==(verOffset=nAgt.indexOf("Chrome"))?(browserName="Chrome",fullVersion=nAgt.substring(verOffset+7)):-1!==(verOffset=nAgt.indexOf("Safari"))?(browserName="Safari",fullVersion=nAgt.substring(verOffset+7),-1!==(verOffset=nAgt.indexOf("Version"))&&(fullVersion=nAgt.substring(verOffset+8))):-1!==(verOffset=nAgt.indexOf("Firefox"))?(browserName="Firefox",fullVersion=nAgt.substring(verOffset+8)):(nameOffset=nAgt.lastIndexOf(" ")+1)<(verOffset=nAgt.lastIndexOf("/"))&&(browserName=nAgt.substring(nameOffset,verOffset),fullVersion=nAgt.substring(verOffset+1),browserName.toLowerCase()===browserName.toUpperCase()&&(browserName=navigator.appName)),-1!==(ix=fullVersion.indexOf(";"))&&(fullVersion=fullVersion.substring(0,ix)),-1!==(ix=fullVersion.indexOf(" "))&&(fullVersion=fullVersion.substring(0,ix)),majorVersion=parseInt(""+fullVersion,10),isNaN(majorVersion)&&(fullVersion=""+parseFloat(navigator.appVersion),majorVersion=parseInt(navigator.appVersion,10)),{fullVersion:fullVersion,version:majorVersion,name:browserName}}function getIPs(callback){function handleCandidate(candidate){var ipRegex=/([0-9]{1,3}(\.[0-9]{1,3}){3})/,ipAddress=ipRegex.exec(candidate)[1];void 0===ipDuplicates[ipAddress]&&callback(ipAddress),ipDuplicates[ipAddress]=!0}var ipDuplicates={},RTCPeerConnection=window.RTCPeerConnection||window.mozRTCPeerConnection||window.webkitRTCPeerConnection,useWebKit=!!window.webkitRTCPeerConnection;if(!RTCPeerConnection){var iframe=document.getElementById("iframe");if(!iframe)throw"NOTE: you need to have an iframe in the page right above the script tag.";var win=iframe.contentWindow;RTCPeerConnection=win.RTCPeerConnection||win.mozRTCPeerConnection||win.webkitRTCPeerConnection,useWebKit=!!win.webkitRTCPeerConnection}var servers,mediaConstraints={optional:[{RtpDataChannels:!0}]};useWebKit&&(servers={iceServers:[{urls:"stun:stun.services.mozilla.com"}]});var pc=new RTCPeerConnection(servers,mediaConstraints);pc.onicecandidate=function(ice){ice.candidate&&handleCandidate(ice.candidate.candidate)},pc.createDataChannel(""),pc.createOffer(function(result){pc.setLocalDescription(result,function(){},function(){})},function(){}),setTimeout(function(){var lines=pc.localDescription.sdp.split("\n");lines.forEach(function(line){0===line.indexOf("a=candidate:")&&handleCandidate(line)})},1e3)}var browser=getBrowserInfo(),isOpera=!!window.opera||navigator.userAgent.indexOf(" OPR/")>=0,isFirefox="undefined"!=typeof InstallTrigger,isSafari=Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0,isChrome=!!window.chrome&&!isOpera,isIE=!!document.documentMode,isMobileDevice=!!navigator.userAgent.match(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile/i),isNodeWebkit=!!(window.process&&"object"==typeof window.process&&window.process.versions&&window.process.versions["node-webkit"]),isHTTPs="https:"===location.protocol;navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices&&(navigator.enumerateDevices=function(callback){navigator.mediaDevices.enumerateDevices().then(callback)}),window.DetectRTC={browser:browser,hasMicrophone:navigator.enumerateDevices?!1:"unable to detect",hasSpeakers:navigator.enumerateDevices?!1:"unable to detect",hasWebcam:navigator.enumerateDevices?!1:"unable to detect",isWebRTCSupported:!!window.webkitRTCPeerConnection||!!window.mozRTCPeerConnection,isAudioContextSupported:!!window.AudioContext&&!!window.AudioContext.prototype.createMediaStreamSource||!!window.webkitAudioContext&&!!window.webkitAudioContext.prototype.createMediaStreamSource,isScreenCapturingSupported:isFirefox&&browser.version>=33||isChrome&&browser.version>=26&&(isNodeWebkit?!0:"https:"===location.protocol),isDesktopCapturingSupported:isHTTPs&&(isFirefox&&browser.version>=33||isChrome&&browser.version>=34||isNodeWebkit||!1),isSctpDataChannelsSupported:isFirefox||isChrome&&browser.version>=25,isRtpDataChannelsSupported:isChrome&&browser.version>=31,isMobileDevice:!!navigator.userAgent.match(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile/i),isWebSocketsSupported:"WebSocket"in window&&2===window.WebSocket.CLOSING,isCanvasCaptureStreamSupported:!1,isVideoCaptureStreamSupported:!1},function(){var canvas=document.createElement("canvas");"function"==typeof canvas.captureStream?DetectRTC.isCanvasCaptureStreamSupported=!0:"function"==typeof canvas.mozCaptureStream?DetectRTC.isCanvasCaptureStreamSupported=!0:"function"==typeof canvas.webkitCaptureStream&&(DetectRTC.isCanvasCaptureStreamSupported=!0)}(),function(){var video=document.createElement("video");"function"==typeof video.captureStream?DetectRTC.isVideoCaptureStreamSupported=!0:"function"==typeof video.mozCaptureStream?DetectRTC.isVideoCaptureStreamSupported=!0:"function"==typeof video.webkitCaptureStream&&(DetectRTC.isVideoCaptureStreamSupported=!0)}(),isHTTPs||(window.DetectRTC.isScreenCapturingSupported=window.DetectRTC.isDesktopCapturingSupported="Requires HTTPs."),DetectRTC.browser={isFirefox:isFirefox,isChrome:isChrome,isMobileDevice:isMobileDevice,isNodeWebkit:isNodeWebkit,isSafari:isSafari,isIE:isIE,isOpera:isOpera,name:browser.name,version:browser.version};var osName="Unknown OS";-1!==navigator.appVersion.indexOf("Win")&&(osName="Windows"),-1!==navigator.appVersion.indexOf("Mac")&&(osName="MacOS"),-1!==navigator.appVersion.indexOf("X11")&&(osName="UNIX"),-1!==navigator.appVersion.indexOf("Linux")&&(osName="Linux"),DetectRTC.osName=osName,DetectRTC.MediaDevices=[],navigator.enumerateDevices||warn("navigator.enumerateDevices API are not available."),navigator.enumerateDevices||window.MediaStreamTrack&&window.MediaStreamTrack.getSources||warn("MediaStreamTrack.getSources are not available."),new CheckDeviceSupport,DetectRTC.load=CheckDeviceSupport,DetectRTC.DetectLocalIPAddress=function(callback){getIPs(function(ip){callback(ip.match(/^(192\.168\.|169\.254\.|10\.|172\.(1[6-9]|2\d|3[01]))/)?"Local: "+ip:"Public: "+ip)})}}();
{
"name": "detectrtc",
"preferGlobal": true,
"version": "1.0.6",
"version": "1.0.7",
"author": {

@@ -6,0 +6,0 @@ "name": "Muaz Khan",

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