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

mediaDevices.enumerateDevices broken in iframe #7565

Closed
escatg opened this issue Sep 7, 2020 · 4 comments
Closed

mediaDevices.enumerateDevices broken in iframe #7565

escatg opened this issue Sep 7, 2020 · 4 comments

Comments

@escatg
Copy link

escatg commented Sep 7, 2020

NWJS Version : from 0.45.2 -> 0.48.1
Operating System : reproduced on Linux and Windows 10

Expected behavior

It should be possible to get a complete list of media devices by calling navigator.mediaDevices.enumerateDevices() after obtaining permission from navigator.mediaDevices.getUserMedia().

Actual behavior

In the iframe, the list of media devices returned is incomplete and contains no label and no deviceId, as if we didn't have the permission to list media devices.

How to reproduce

  • Upgrade to nw.js >= 0.45.2 (worked fine before).
  • Run the attached code mediadevices_test.zip
  • Application will open showing a complete media device list in the main window and an incomplete one in the iframe.

expected output

Partial workaround: adding --use-fake-ui-for-media-stream in chromium_flags allows it to work again in iframe, but other things break like screen sharing.
Just tested with --disable-features=nw2 which also seems to restore expected behavior in iframe.

@escatg
Copy link
Author

escatg commented Sep 7, 2020

Linking to #7230

@rogerwang
Copy link
Member

In NW2 there is better control for device access. You are loading code from remote domain in iframe to access local devices, which is blocked by default. This can be allowed by using chrome.contentSettings api .

So close as a non-issue for now.

@bschmitlin
Copy link

For the record, regardeless of the Chrome extenion contentSettings, you need to add --use-fake-ui-for-media-stream to chromium-args properly get the devices name in enumerateDevices()

@monema75
Copy link

monema75 commented Jan 28, 2022

I have the same problem. Same scenario but NWJS version 0.52.2

In order to get the devices name --use-fake-ui-for-media-stream is needed in chromium_flags but then screenSharing is not correctly working. getDisplayMedia is returning a DOMException: Could not start video source.

Am I missing something?

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

4 participants