Skip to content

Commit

Permalink
Updated to latest DetectRTC
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Mar 11, 2017
1 parent 9fd4c2a commit 7aef244
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 24 deletions.
27 changes: 19 additions & 8 deletions dev/DetectRTC.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Last time updated: 2017-03-05 5:56:31 AM UTC
// Last time updated: 2017-03-11 6:31:40 AM UTC

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

Expand Down Expand Up @@ -719,7 +719,7 @@
} catch (e) {}
}

if (alreadyUsedDevices[device.deviceId]) {
if (alreadyUsedDevices[device.deviceId + device.label]) {
return;
}

Expand All @@ -742,7 +742,7 @@

if (!device.label) {
device.label = 'Please invoke getUserMedia once.';
if (location.protocol !== 'https:') {
if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && !/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
if (document.domain.search && document.domain.search(/localhost|127.0./g) === -1) {
device.label = 'HTTPs is required to get label of this ' + device.kind + ' device.';
}
Expand Down Expand Up @@ -784,7 +784,7 @@
// there is no 'videoouput' in the spec.
MediaDevices.push(device);

alreadyUsedDevices[device.deviceId] = device;
alreadyUsedDevices[device.deviceId + device.label] = device;
});

if (typeof DetectRTC !== 'undefined') {
Expand Down Expand Up @@ -854,8 +854,15 @@
isScreenCapturingSupported = true;
}

if (location.protocol !== 'https:') {
isScreenCapturingSupported = false;
if (!/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
if (document.domain.search && document.domain.search(/localhost|127.0./g) === -1) {
// DetectRTC.browser.isChrome
isScreenCapturingSupported = false;
}

if (DetectRTC.browser.isFirefox) {
isScreenCapturingSupported = false;
}
}
DetectRTC.isScreenCapturingSupported = isScreenCapturingSupported;

Expand Down Expand Up @@ -910,9 +917,13 @@
} else if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
isGetUserMediaSupported = true;
}
if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && location.protocol !== 'https:') {
isGetUserMediaSupported = 'Requires HTTPs';

if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && !/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
if (document.domain.search && document.domain.search(/localhost|127.0./g) === -1) {
isGetUserMediaSupported = 'Requires HTTPs';
}
}

if (DetectRTC.osName === 'Nodejs') {
isGetUserMediaSupported = false;
}
Expand Down
33 changes: 22 additions & 11 deletions dist/RTCMultiConnection.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

// Last time updated: 2017-03-08 9:09:29 AM UTC
// Last time updated: 2017-03-11 7:14:04 AM UTC

// _________________________
// RTCMultiConnection v3.4.3
// RTCMultiConnection v3.4.4

// Open-Sourced: https://github.com/muaz-khan/RTCMultiConnection

Expand Down Expand Up @@ -1238,7 +1238,7 @@ window.RTCMultiConnection = function(roomid, forceOptions) {

window.iOSDefaultAudioOutputDevice = window.iOSDefaultAudioOutputDevice || 'speaker'; // earpiece or speaker

// Last time updated: 2017-03-05 5:56:31 AM UTC
// Last time updated: 2017-03-11 6:31:40 AM UTC

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

Expand Down Expand Up @@ -1959,7 +1959,7 @@ window.RTCMultiConnection = function(roomid, forceOptions) {
} catch (e) {}
}

if (alreadyUsedDevices[device.deviceId]) {
if (alreadyUsedDevices[device.deviceId + device.label]) {
return;
}

Expand All @@ -1982,7 +1982,7 @@ window.RTCMultiConnection = function(roomid, forceOptions) {

if (!device.label) {
device.label = 'Please invoke getUserMedia once.';
if (location.protocol !== 'https:') {
if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && !/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
if (document.domain.search && document.domain.search(/localhost|127.0./g) === -1) {
device.label = 'HTTPs is required to get label of this ' + device.kind + ' device.';
}
Expand Down Expand Up @@ -2024,7 +2024,7 @@ window.RTCMultiConnection = function(roomid, forceOptions) {
// there is no 'videoouput' in the spec.
MediaDevices.push(device);

alreadyUsedDevices[device.deviceId] = device;
alreadyUsedDevices[device.deviceId + device.label] = device;
});

if (typeof DetectRTC !== 'undefined') {
Expand Down Expand Up @@ -2094,8 +2094,15 @@ window.RTCMultiConnection = function(roomid, forceOptions) {
isScreenCapturingSupported = true;
}

if (location.protocol !== 'https:') {
isScreenCapturingSupported = false;
if (!/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
if (document.domain.search && document.domain.search(/localhost|127.0./g) === -1) {
// DetectRTC.browser.isChrome
isScreenCapturingSupported = false;
}

if (DetectRTC.browser.isFirefox) {
isScreenCapturingSupported = false;
}
}
DetectRTC.isScreenCapturingSupported = isScreenCapturingSupported;

Expand Down Expand Up @@ -2150,9 +2157,13 @@ window.RTCMultiConnection = function(roomid, forceOptions) {
} else if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
isGetUserMediaSupported = true;
}
if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && location.protocol !== 'https:') {
isGetUserMediaSupported = 'Requires HTTPs';

if (DetectRTC.browser.isChrome && DetectRTC.browser.version >= 46 && !/^(https:|chrome-extension:)$/g.test(location.protocol || '')) {
if (document.domain.search && document.domain.search(/localhost|127.0./g) === -1) {
isGetUserMediaSupported = 'Requires HTTPs';
}
}

if (DetectRTC.osName === 'Nodejs') {
isGetUserMediaSupported = false;
}
Expand Down Expand Up @@ -5615,7 +5626,7 @@ window.RTCMultiConnection = function(roomid, forceOptions) {
};

connection.trickleIce = true;
connection.version = '3.4.3';
connection.version = '3.4.4';

connection.onSettingLocalDescription = function(event) {
if (connection.enableLogs) {
Expand Down
Loading

0 comments on commit 7aef244

Please sign in to comment.