Skip to content

Commit

Permalink
Added detectrtc@1.3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Mar 5, 2017
1 parent 028005f commit 27285b8
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 28 deletions.
15 changes: 12 additions & 3 deletions .npmignore
@@ -1,3 +1,12 @@
node_modules
lib-cov
npm-debug.log
# ignore everything
*

# but not these files...
!DetectRTC.js
!DetectRTC.min.js
!index.html
!package.json
!bower.json
!npm-test.js
!server.js
!README.md
35 changes: 28 additions & 7 deletions DetectRTC.js
@@ -1,4 +1,4 @@
// Last time updated: 2017-03-04 2:09:01 PM UTC
// Last time updated: 2017-03-05 5:56:31 AM UTC

// Latest file can be found here: https://cdn.webrtc-experiment.com/DetectRTC.js

Expand All @@ -18,6 +18,12 @@

var browserFakeUserAgent = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45';

var isNodejs = typeof process === 'object' && typeof process.versions === 'object' && process.versions.node;
if (isNodejs) {
var version = process.versions.node.toString().replace('v', '');
browserFakeUserAgent = 'Nodejs/' + version + ' (NodeOS) AppleWebKit/' + version + ' (KHTML, like Gecko) Nodejs/' + version + ' Nodejs/' + version
}

(function(that) {
if (typeof window !== 'undefined') {
return;
Expand Down Expand Up @@ -486,6 +492,13 @@
}
}

var isNodejs = typeof process === 'object' && typeof process.versions === 'object' && process.versions.node;

if (osName === 'Unknown OS' && isNodejs) {
osName = 'Nodejs';
osVersion = process.versions.node.toString().replace('v', '');
}

var isCanvasSupportsStreamCapturing = false;
var isVideoSupportsStreamCapturing = false;
['captureStream', 'mozCaptureStream', 'webkitCaptureStream'].forEach(function(item) {
Expand Down Expand Up @@ -811,7 +824,11 @@
// DetectRTC.isChrome || DetectRTC.isFirefox || DetectRTC.isEdge
DetectRTC.browser['is' + DetectRTC.browser.name] = true;

var isNodeWebkit = !!(window.process && (typeof window.process === 'object') && window.process.versions && window.process.versions['node-webkit']);
// -----------
DetectRTC.osName = osName;
DetectRTC.osVersion = osVersion;

var isNodeWebkit = typeof process === 'object' && typeof process.versions === 'object' && process.versions['node-webkit'];

// --------- Detect if system supports WebRTC 1.0 or WebRTC 1.1.
var isWebRTCSupported = false;
Expand Down Expand Up @@ -894,14 +911,13 @@
isGetUserMediaSupported = true;
}
if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && location.protocol !== 'https:') {
DetectRTC.isGetUserMediaSupported = 'Requires HTTPs';
isGetUserMediaSupported = 'Requires HTTPs';
}
if (DetectRTC.osName === 'Nodejs') {
isGetUserMediaSupported = false;
}
DetectRTC.isGetUserMediaSupported = isGetUserMediaSupported;

// -----------
DetectRTC.osName = osName;
DetectRTC.osVersion = osVersion;

var displayResolution = '';
if (screen.width) {
var width = (screen.width) ? screen.width : '';
Expand Down Expand Up @@ -930,6 +946,11 @@
DetectRTC.isWebSocketsSupported = 'WebSocket' in window && 2 === window.WebSocket.CLOSING;
DetectRTC.isWebSocketsBlocked = !DetectRTC.isWebSocketsSupported;

if (DetectRTC.osName === 'Nodejs') {
DetectRTC.isWebSocketsSupported = true;
DetectRTC.isWebSocketsBlocked = false;
}

DetectRTC.checkWebSocketsSupport = function(callback) {
callback = callback || function() {};
try {
Expand Down
4 changes: 2 additions & 2 deletions DetectRTC.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -88,7 +88,7 @@ node npm-test.js
You can even link specific versions:

```html
<script src="https://github.com/muaz-khan/DetectRTC/releases/download/1.3.2/DetectRTC.js"></script>
<script src="https://github.com/muaz-khan/DetectRTC/releases/download/1.3.4/DetectRTC.js"></script>
```

<img src="https://cdn.webrtc-experiment.com/images/DetectRTC.png" style="width:100%;" />
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "detectrtc",
"version": "1.3.3",
"version": "1.3.4",
"authors": [
{
"name": "Muaz Khan",
Expand Down
20 changes: 14 additions & 6 deletions dev/DetectRTC.js
Expand Up @@ -11,7 +11,11 @@ detectPrivateMode(function(isPrivateBrowsing) {
// DetectRTC.isChrome || DetectRTC.isFirefox || DetectRTC.isEdge
DetectRTC.browser['is' + DetectRTC.browser.name] = true;

var isNodeWebkit = !!(window.process && (typeof window.process === 'object') && window.process.versions && window.process.versions['node-webkit']);
// -----------
DetectRTC.osName = osName;
DetectRTC.osVersion = osVersion;

var isNodeWebkit = typeof process === 'object' && typeof process.versions === 'object' && process.versions['node-webkit'];

// --------- Detect if system supports WebRTC 1.0 or WebRTC 1.1.
var isWebRTCSupported = false;
Expand Down Expand Up @@ -94,14 +98,13 @@ if (navigator.getUserMedia) {
isGetUserMediaSupported = true;
}
if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && location.protocol !== 'https:') {
DetectRTC.isGetUserMediaSupported = 'Requires HTTPs';
isGetUserMediaSupported = 'Requires HTTPs';
}
if (DetectRTC.osName === 'Nodejs') {
isGetUserMediaSupported = false;
}
DetectRTC.isGetUserMediaSupported = isGetUserMediaSupported;

// -----------
DetectRTC.osName = osName;
DetectRTC.osVersion = osVersion;

var displayResolution = '';
if (screen.width) {
var width = (screen.width) ? screen.width : '';
Expand Down Expand Up @@ -130,6 +133,11 @@ DetectRTC.DetectLocalIPAddress = DetectLocalIPAddress;
DetectRTC.isWebSocketsSupported = 'WebSocket' in window && 2 === window.WebSocket.CLOSING;
DetectRTC.isWebSocketsBlocked = !DetectRTC.isWebSocketsSupported;

if (DetectRTC.osName === 'Nodejs') {
DetectRTC.isWebSocketsSupported = true;
DetectRTC.isWebSocketsBlocked = false;
}

DetectRTC.checkWebSocketsSupport = function(callback) {
callback = callback || function() {};
try {
Expand Down
6 changes: 6 additions & 0 deletions dev/common.js
@@ -1,5 +1,11 @@
var browserFakeUserAgent = 'Fake/5.0 (FakeOS) AppleWebKit/123 (KHTML, like Gecko) Fake/12.3.4567.89 Fake/123.45';

var isNodejs = typeof process === 'object' && typeof process.versions === 'object' && process.versions.node;
if (isNodejs) {
var version = process.versions.node.toString().replace('v', '');
browserFakeUserAgent = 'Nodejs/' + version + ' (NodeOS) AppleWebKit/' + version + ' (KHTML, like Gecko) Nodejs/' + version + ' Nodejs/' + version
}

(function(that) {
if (typeof window !== 'undefined') {
return;
Expand Down
7 changes: 7 additions & 0 deletions dev/detectOSName.js
Expand Up @@ -19,3 +19,10 @@ if (osInfo && osInfo.osName && osInfo.osName != '-') {
osVersion = getAndroidVersion();
}
}

var isNodejs = typeof process === 'object' && typeof process.versions === 'object' && process.versions.node;

if (osName === 'Unknown OS' && isNodejs) {
osName = 'Nodejs';
osVersion = process.versions.node.toString().replace('v', '');
}
11 changes: 4 additions & 7 deletions npm-test.js
Expand Up @@ -2,10 +2,7 @@

var DetectRTC = require('detectrtc');

console.log(DetectRTC.browser);

console.log('\n\n-------\n\n');

DetectRTC.load(function() {
console.log(DetectRTC);
});
console.log(DetectRTC.browser.name + ' version ' + DetectRTC.browser.version);
console.log(DetectRTC.osName + ' version ' + DetectRTC.osVersion);
console.log(JSON.stringify(DetectRTC));
console.log(DetectRTC);
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "detectrtc",
"preferGlobal": false,
"version": "1.3.3",
"version": "1.3.4",
"author": {
"name": "Muaz Khan",
"email": "muazkh@gmail.com",
Expand Down

0 comments on commit 27285b8

Please sign in to comment.