Skip to content

Commit

Permalink
fix chrome detection on insecure contexts
Browse files Browse the repository at this point in the history
Fixes #935 which is the chrome detection on insecure contexts where webkitGetUserMedia was removed along with getUserMedia in M74+.
Fallback is to check for webkitRTCPeerConnection which avoiding Edge by checking for RTCIceGatherer.
  • Loading branch information
fippo committed Apr 2, 2019
1 parent 5162288 commit 1d1fe90
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,13 @@ export function detectBrowser(window) {
result.browser = 'firefox';
result.version = extractVersion(navigator.userAgent,
/Firefox\/(\d+)\./, 1);
} else if (navigator.webkitGetUserMedia) {
} else if (navigator.webkitGetUserMedia ||
(window.isSecureContext === false && window.webkitRTCPeerConnection &&
!window.RTCIceGatherer)) {
// Chrome, Chromium, Webview, Opera.
// Version matches Chrome/WebRTC version.
// Chrome 74 removed webkitGetUserMedia on http as well so we need the
// more complicated fallback to webkitRTCPeerConnection.
result.browser = 'chrome';
result.version = extractVersion(navigator.userAgent,
/Chrom(e|ium)\/(\d+)\./, 2);
Expand Down

0 comments on commit 1d1fe90

Please sign in to comment.