Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

iOS 13.4 navigator.mediaDevices.enumerateDevices resulting in hasWebcam = false #88

Open
denkerinteraktivgmbh opened this issue Apr 2, 2020 · 6 comments

Comments

@denkerinteraktivgmbh
Copy link

denkerinteraktivgmbh commented Apr 2, 2020

Hi, folks!

We are having issues with DetectRTC.hasWebcam. DetectRTC is calling navigator.mediaDevices.enumerateDevices multiple times. That conflicts with a strange behaviour/bug on iOS 13.4. DetectRTC loops trough the media devices after 1+n call of navigator.mediaDevices.enumerateDevicesso webkit only returns MediaDeviceInfo having
kind: "audioinput". This leads to DetectRTC.hasWebcam = false.

To reproduce this open the Safari Remote Webinspector and execute navigator.mediaDevices.enumerateDevices(); in the console.

First Call:

MediaDeviceInfo {deviceId: "", kind: "audioinput", label: "", groupId: "", toJSON: function}
MediaDeviceInfo {deviceId: "", kind: "videoinput", label: "", groupId: "", toJSON: function}

Second call:

MediaDeviceInfo {deviceId: "", kind: "audioinput", label: "", groupId: "", toJSON: function}
MediaDeviceInfo {deviceId: "", kind: "audioinput", label: "", groupId: "", toJSON: function}
@TyLindberg
Copy link

We're seeing similar behavior on MacOS Safari 13.1, with DetectRTC.hasWebcam = false there too.

@HiddenType
Copy link

HiddenType commented Apr 4, 2020

This happens in Safari 13.1 on iOS 13.4, iPadOS 13.4 and MacOS 10.15.4.

Whereas it does not happen on iPadOS 13.3.1.

But it only happens in Safari 13.1 when camera is not set to "allow" in website settings.

So I guess that from now on one can only get device information after access has been granted.
Chrome (Desktop & Android) and Firefox expose device information regardless of website settings.

@atav32
Copy link

atav32 commented Apr 24, 2020

Still seeing this on iOS 13.4.1

@nemoneph
Copy link

Indeed same here one IOS 13.4.1

@kasperkamperman
Copy link

I did some workaround in my own code and removed DetectRTC dependency.
Maybe useful for other people: kasperkamperman/MobileCameraTemplate#9

Indeed Safari first needs permission (getUserMedia) before enumerateDevices returns the correct data.
https://webrtchacks.com/guide-to-safari-webrtc/

@willmorgan
Copy link

iOS 13.5 and subsequent versions don't seem to exhibit this issue anymore.

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

No branches or pull requests

7 participants