Comparing version 1.0.5 to 1.0.6
@@ -1,2 +0,2 @@ | ||
// Last time updated at May 05, 2015, 08:32:23 | ||
// Last time updated at May 28, 2015, 08:32:23 | ||
@@ -80,5 +80,31 @@ // Latest file can be found here: https://cdn.webrtc-experiment.com/DetectRTC.js | ||
isMobileDevice: !!navigator.userAgent.match(/Android|iPhone|iPad|iPod|BlackBerry|IEMobile/i), | ||
isWebSocketsSupported: 'WebSocket' in window && 2 === window.WebSocket.CLOSING | ||
isWebSocketsSupported: 'WebSocket' in window && 2 === window.WebSocket.CLOSING, | ||
isCanvasCaptureStreamSupported: false, | ||
isVideoCaptureStreamSupported: false | ||
}; | ||
(function detectCanvasCaptureStream() { | ||
// latest Firefox nighly is supporting this "awesome" feature! | ||
var canvas = document.createElement('canvas'); | ||
if (typeof canvas.captureStream === 'function') { | ||
DetectRTC.isCanvasCaptureStreamSupported = true; | ||
} else if (typeof canvas.mozCaptureStream === 'function') { | ||
DetectRTC.isCanvasCaptureStreamSupported = true; | ||
} else if (typeof canvas.webkitCaptureStream === 'function') { | ||
DetectRTC.isCanvasCaptureStreamSupported = true; | ||
} | ||
})(); | ||
(function detectVideoCaptureStream() { | ||
var video = document.createElement('video'); | ||
if (typeof video.captureStream === 'function') { | ||
DetectRTC.isVideoCaptureStreamSupported = true; | ||
} else if (typeof video.mozCaptureStream === 'function') { | ||
DetectRTC.isVideoCaptureStreamSupported = true; | ||
} else if (typeof video.webkitCaptureStream === 'function') { | ||
DetectRTC.isVideoCaptureStreamSupported = true; | ||
} | ||
})(); | ||
if (!isHTTPs) { | ||
@@ -85,0 +111,0 @@ window.DetectRTC.isScreenCapturingSupported = |
@@ -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},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.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)})}}(); |
{ | ||
"name": "detectrtc", | ||
"preferGlobal": true, | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Muaz Khan", |
@@ -55,2 +55,5 @@ # [DetectRTC.js](https://github.com/muaz-khan/DetectRTC) / [Demo](https://www.webrtc-experiment.com/DetectRTC/) [![npm](https://img.shields.io/npm/v/detectrtc.svg)](https://npmjs.org/package/detectrtc) [![downloads](https://img.shields.io/npm/dm/detectrtc.svg)](https://npmjs.org/package/detectrtc) [![Build Status: Linux](https://travis-ci.org/muaz-khan/DetectRTC.png?branch=master)](https://travis-ci.org/muaz-khan/DetectRTC) | ||
// isCanvasCaptureStreamSupported | ||
// isVideoCaptureStreamSupported | ||
// DetectRTC.DetectLocalIPAddress(callback) | ||
@@ -57,0 +60,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42262
10
485
75