Skip to content

Commit

Permalink
drop support for insecure contexts
Browse files Browse the repository at this point in the history
getUserMedia was recently made [SecureContext] and does not exist when running on http. This lead, similar to the scenario in #764 to Chrome being detected as Safari, activating the wrong shims.

RTCPeerConnection will still be available but can only be used for datachannels and receive-only contexts where adapter doesn't offer much benefit.

Fixes #935, requires a major version bump.
  • Loading branch information
fippo committed Mar 28, 2019
1 parent a538b52 commit 911ce0a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,11 @@ export function detectBrowser(window) {
return result;
}

if (window.isSecureContext === false) {
result.browser = 'Insecure Contexts are no longer supported.';
return result;
}

if (navigator.mozGetUserMedia) { // Firefox.
result.browser = 'firefox';
result.version = extractVersion(navigator.userAgent,
Expand All @@ -159,7 +164,7 @@ export function detectBrowser(window) {
result.browser = 'edge';
result.version = extractVersion(navigator.userAgent,
/Edge\/(\d+).(\d+)$/, 2);
} else if (window.RTCPeerConnection &&
} else if (navigator.mediaDevices && window.RTCPeerConnection &&
navigator.userAgent.match(/AppleWebKit\/(\d+)\./)) { // Safari.
result.browser = 'safari';
result.version = extractVersion(navigator.userAgent,
Expand Down

0 comments on commit 911ce0a

Please sign in to comment.