wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
23.67k stars 1.13k forks source link

Frontend is unable to access mediaDevices #3466

Open whiteboxsolutions opened 2 months ago

whiteboxsolutions commented 2 months ago

Description

Frontend javascript is unable to access mediaDevices via window.navigator.mediaDevices. Running the enumerateDevices() method returns a promise which fulfills with an empty list.

This issue is intermittent, and can't seem to be reproduced on my machine in either dev, debug nor release builds. It happens on end user machines randomly

To Reproduce

Intermittently:

  1. Compile demo application as a debug release
  2. Run binary on non-developer machine
  3. Open dev tools
  4. Run window.navigator.mediaDevices.enumerateDevices() in dev console

Expected behaviour

enumerateDevices() method returns a promise which when fulfilled provides a list of video and audio devices and their IDs.

Screenshots

No response

Attempted Fixes

Restarting the application seems to fix things most of the time.

System Details

DEB | Using go webview2loader
Wails CLI v2.5.1

 SUCCESS  Done.

# System

OS           | Windows 10 Pro     
Version      | 2009 (Build: 19045)
ID           | 22H2
Go Version   | go1.20.4
Platform     | windows
Architecture | amd64

# Wails

Version | v2.5.1

# Dependencies

Dependency | Package Name | Status    | Version
WebView2   | N/A          | Installed | 124.0.2478.80
Nodejs     | N/A          | Installed | 20.5.0
npm        | N/A          | Installed | 9.8.0
*upx       | N/A          | Installed | upx 4.0.2
*nsis      | N/A          | Installed | v3.09
* - Optional Dependency

# Diagnosis

Your system is ready for Wails development!

Additional context

No response

leaanthony commented 2 months ago

Thanks for opening. I suspect it's a webview2 version issue. Is it possible to the version they have installed? You should be able to get it from navigator.userAgent

whiteboxsolutions commented 2 months ago

Checked that - user's useragent matches my dev machines:

'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36 Edg/124.0.0.0'

It's weird that it's intermittent - I'm wondering if it could be a windows defender sandboxing issue or something.

The application is being run as administrator as well