Skip to content

Turborepo with Electron causes issues with MediaDevices #10957

@GavynWithLayer

Description

@GavynWithLayer

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

https://github.com/GavynWithLayer/electron-getusermedia-bug

Which canary version will you have in your reproduction?

[email protected]

Environment information

CLI:
   Version: 2.5.9-canary.7
   Path to executable: $(path_to_projects)/electron-getusermedia-bug/node_modules/turbo-linux-64/bin/turbo
   Daemon status: Running
   Package manager: npm

Platform:
   Architecture: x86_64
   Operating system: linux
   WSL: false
   Available memory (MB): 116370
   Available CPU cores: 32

Environment:
   CI: None
   Terminal (TERM): xterm-256color
   Terminal program (TERM_PROGRAM): unknown
   Terminal program version (TERM_PROGRAM_VERSION): unknown
   Shell (SHELL): /bin/bash
   stdin: false

Expected behavior

According to Mozilla Docs, navigator.mediaDevices.enumerateDevices() should list the devices in a specific order, with the default devices first.

On my machine, the result should be:

audioinput: Default id = default
audioinput: HyperX QuadCast S Analog Stereo id = 6a558693e6756d36ff8f02e3cb618164bab80cd139fd5303f8d55ffffbce59f2
videoinput: C922 Pro Stream Webcam (046d:085c) id = 754f97d50f8bc14c0f27ecf5943a730f08d7dfe4d5c59b6ddf5ba92220da579b
audiooutput: Default id = default
audiooutput: FiiO K5 Pro Analog Stereo id = 61f1c834abbe35c8fbb9a8e4be04909f52748b9288b0d8bf96d9b4947cc67965

If I run the electron app from the example repo attached manually (not with turborepo), this is the list I get.

Actual behavior

When I run the same electron app with turborepo, I get:

audioinput: Default id = default
audioinput: HD-Audio Generic, ALCS1200A Analog-Default Audio Device id = 4b4e3152c154cac2d18646e49c0565a8d7b56ed19c062134cfd7973494b7a036
audioinput: HD-Audio Generic, ALCS1200A Analog-Front output / input id = 10be6ff7b447b901c08ad29a174cbfc0907c2af8910b24a3c3037ced9f56fe54
audioinput: HyperX QuadCast S, USB Audio-Default Audio Device id = 6e4a2875a3ed070b471bdece4df847839f6a230c704d1f62ca3722030762ed92
audioinput: HyperX QuadCast S, USB Audio-Front output / input id = 82d9f77b3f74b2adbd5c75728cdb3d18d0511d275ebd21ff0b33075804e5faf8
audioinput: C922 Pro Stream Webcam, USB Audio-Default Audio Device id = 98cce849c36474db1b3fa74d8cf6acb4d33480e14b6c05fcf7d2eac8e2d1e4a7
audioinput: C922 Pro Stream Webcam, USB Audio-Front output / input id = 3082a3d7f4aa628e97da43eed2c1a8a04a97c1e03e1d8f77ca60be1e3d0faea5
videoinput: C922 Pro Stream Webcam (046d:085c) id = 1238f445d0f216e8c91652a1cb544889c1d2079bd5e9c5a766649c594a80d3d8
audiooutput: Default id = default
  1. It shows devices I've disabled in pulseaudio, which is incorrect.
  2. The default devices are incorrect.
  3. It has no audiooutput devices.

To Reproduce

I believe this issue is limited to linux.

In the example repo attached, run turbo run start to launch the electron app and view your devices.

To launch the electron app without turborepo, cd apps/media-device-enumeration-test and npm run start.

If you don't immediately see any discrepancies between the two lists, try changing your default devices and see if they both update correctly.

Additional context

I tested on linux and mac, but could only reproduce on linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions