Skip to content

Firefox will be identified as "Not a supported browser." if mozGetUserMedia is removed #1156

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
jan-ivar opened this issue Apr 16, 2024 · 6 comments · May be fixed by #1160
Open

Firefox will be identified as "Not a supported browser." if mozGetUserMedia is removed #1156

jan-ivar opened this issue Apr 16, 2024 · 6 comments · May be fixed by #1160

Comments

@jan-ivar
Copy link
Collaborator

#764 identified problematic detectBrowser code which prevents browsers from removing non-standard APIs:

    if (navigator.mozGetUserMedia) { // Firefox.
      result.browser = 'firefox';
      result.version = extractVersion(navigator.userAgent,
          /Firefox\/(\d+)\./, 1);
    } else if (navigator.webkitGetUserMedia) {
      // Chrome, Chromium, Webview, Opera.
      // Version matches Chrome/WebRTC version.
      result.browser = 'chrome';
      result.version = extractVersion(navigator.userAgent,
          /Chrom(e|ium)\/(\d+)\./, 2);
    } else if (navigator.mediaDevices &&
        navigator.userAgent.match(/Edge\/(\d+).(\d+)$/)) { // Edge.
      result.browser = 'edge';
      result.version = extractVersion(navigator.userAgent,
          /Edge\/(\d+).(\d+)$/, 2);
    } else if (navigator.mediaDevices &&
        navigator.userAgent.match(/AppleWebKit\/(\d+)\./)) { // Safari.
      result.browser = 'safari';
      result.version = extractVersion(navigator.userAgent,
          /AppleWebKit\/(\d+)\./, 1);
    } else { // Default fallthrough: not supported.
      result.browser = 'Not a supported browser.';
      return result;
    }

E.g. Firefox cannot remove mozGetUserMedia without this returning "Not a supported browser."

The #1146 fix to #764 is unsatisfactory, relying on an API that is not standards-track to solve this problem only for Chromium.

The core problem, that this function treats browsers without specific non-standard APIs as "Not a supported browser." remains unaddressed.

@fippo
Copy link
Member

fippo commented Apr 16, 2024

From what I recall you agreed to this in the context of #151 -- it has been a while though.

@jan-ivar
Copy link
Collaborator Author

Thanks for the link. To clarify, I intimated "there are no plans to unprefix it." on navigator. We have plans to remove it.

@fippo
Copy link
Member

fippo commented Apr 17, 2024

If you want to do something more effective than breaking a ton of sites and reducing Firefox WebRTC reach further make that method throw but keep it around?

@fippo
Copy link
Member

fippo commented Dec 1, 2024

https://developer.mozilla.org/en-US/docs/Web/API/RTCSessionDescription/RTCSessionDescription -- removing the callback variant here might prevent more adoption of navigator.getUserMedia (it is surprising that MDN has examples that do not even work in Firefox, no?)

@fippo
Copy link
Member

fippo commented Jan 24, 2025

@jan-ivar jan-ivar linked a pull request Feb 27, 2025 that will close this issue
@kkkkkkh-dd

This comment has been minimized.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants