Skip to content

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

Open

Description

@jan-ivar

#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.

Activity

  1. fippo commented on Apr 16, 2024

    @fippo
    Member

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

  2. jan-ivar commented on Apr 16, 2024

    @jan-ivar
    CollaboratorAuthor

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

  3. fippo commented on Apr 17, 2024

    @fippo
    Member

    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?

  4. fippo commented on Dec 1, 2024

    @fippo
    Member

    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?)

  5. kor0000 commented on Apr 18, 2025

    @kor0000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions