[mediacapture-main] (webkit|moz)getUserMedia usage and webcompat issues (#992)

karlcow has just created a new issue for https://github.com/w3c/mediacapture-main:

== (webkit|moz)getUserMedia usage and webcompat issues ==
On [navigator.getUserMedia still creates webcompat issues](https://github.com/whatwg/compat/issues/266), I was trying to understand what is the current state of implementations.

| API | WebKit | Gecko | Blink |
|-|-|-|-|
| `navigator.getUserMedia`| `undefined` | `undefined` | ✅ |
| `navigator.webkitGetUserMedia`| `undefined` | `undefined`  | ✅ |
| `navigator.mozGetUserMedia`| `undefined` | ✅  | `undefined` |
| `navigator.mediaDevices.getUserMedia`| ✅ | ✅  | ✅ |

Some bugs have been opened for Gecko and Blink to deprecate/remove the prefixed version of `navigator.getUserMedia`

* Gecko [Deprecate navigator.mozGetUserMedia()](https://bugzilla.mozilla.org/show_bug.cgi?id=1609254). It didn't happen yet.
* Blink [Remove navigator.webkitGetUserMedia](https://issues.chromium.org/issues/40506759), [Deprecate navigator.getUserMedia()](https://issues.chromium.org/issues/40225258)
* seeAlso [WPT for not supporting it](https://github.com/web-platform-tests/wpt/pull/44909/files)


WebKit is getting breakage because of code like 

```js
navigator.getUserMedia =
  navigator.getUserMedia ||
  navigator.webkitGetUserMedia ||
  navigator.mozGetUserMedia ||
  navigator.msGetUserMedia;
```

Trying to explore further the implementation history around WebKit

* Apr 2011: [Media Stream API: add the getUserMedia method and the Javascript bindings](https://bugs.webkit.org/show_bug.cgi?id=56586). This was adding in fact `navigator.webkitGetUserMedia`
* Some back and forth for implementing, adjustment to match spec changes.
* Apr 2015: Support for [`navigator.mediaDevices.getUserMedia()`](https://bugs.webkit.org/show_bug.cgi?id=143255)
* Jun 2016: [getUserMedia() exposed, but not functional](https://bugs.webkit.org/show_bug.cgi?id=158393)
* **Feb 9, 2017**:[[MediaStream] Remove legacy Navigator.webkitGetUserMedia](https://bugs.webkit.org/show_bug.cgi?id=168016)
* **Feb 14, 2017**: [[MediaStream] add navigator.getUserMedia for compatibility with legacy content](https://bugs.webkit.org/show_bug.cgi?id=168324)
* **Aug 2018**: [Remove WebRTC legacy API implementation](https://bugs.webkit.org/show_bug.cgi?id=189040)
* Mar 2020: [navigator.getUserMedia is not available in WKWebView iOS 13.4 beta 4](https://bugs.webkit.org/show_bug.cgi?id=208788)


# Some questions

* What is the usage situation for Blink, Gecko on the prefixed versions?
* Is their will to remove them soonish? (and do site interventions at least for Gecko)
* Or was there attempt to remove that were reverted because of compat issues?

The [spec is currently saying](https://w3c.github.io/mediacapture-main/#legacy-getusermedia-interface):

> This decision reflected consensus as long as the original API remained available here under the Navigator object for backwards compatibility reasons, since the working group acknowledges that early users of these APIs have been encouraged to define getUserMedia as "var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;" in order for their code to be functional both before and after official implementations of getUserMedia() in popular browsers. To ensure functional equivalence, the getUserMedia() method here is defined in terms of the method under MediaDevices.





Please view or discuss this issue at https://github.com/w3c/mediacapture-main/issues/992 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 6 March 2024 02:18:03 UTC