Skip to content

[bug] CEF: navigator.mediaDevices.enumerateDevices() shows redacted device list #15905

Description

@Waquo

Describe the bug

The current implementation of bypassing CEF media permissions seems to leave CEF in a broken state where you can connect to media devices, but navigator.mediaDevices.enumerateDevices() returns redacted data that leave you unable to select a device.

    {
        "deviceId": "",
        "kind": "audioinput",
        "label": "",
        "groupId": ""
    },
    {
        "deviceId": "",
        "kind": "videoinput",
        "label": "",
        "groupId": ""
    },
    {
        "deviceId": "",
        "kind": "audiooutput",
        "label": "",
        "groupId": ""
    }
]

The reason might be that while media devices can be accessed, navigator.permissions.query({ name: "camera" }) keeps returning prompt and not granted.

I tested a bit and it turns out that if you just don't bypass media permissions, CEF/Chromium's defaults take over, the user is shown a prompt for permission and if they grant it, things just work.
navigator.permissions.query({ name: "camera" }) returns granted and navigator.mediaDevices.enumerateDevices() returns an unredacted, usable list of devices.
This is consistent with Tauri/Wry/WebView2 also prompting the user for permission.

Reproduction

Repro can be found here https://github.com/Waquo/tauri-cef-enumeratedevices-test
Or you create a fresh Tauri project and switch to the feat/cef branch in src-tauri/Cargo.toml by changing the tauri dependency line to

[dependencies]
tauri = { version = "2", default-features = false, features = ["cef"] }

And adding a patch crates section

[patch.crates-io]
tauri = { git = "https://github.com/tauri-apps/tauri", branch = "feat/cef" }
tauri-build = { git = "https://github.com/tauri-apps/tauri", branch = "feat/cef" }

Or you could test my bugfix here (PR incoming)

[patch.crates-io]
tauri = { git = "https://github.com/Waquo/tauri", branch = "fix-cef-media-permissions" }
tauri-build = { git = "https://github.com/Waquo/tauri", branch = "fix-cef-media-permissions" }

And using this main.ts

async function main() {
  /* trigger media permission prompt to allow enumarateDevices to return an unredacted list */
  let stream = await navigator.mediaDevices.getUserMedia({
    video: true,
  });
  stream.getVideoTracks().forEach((track) => { track.stop() });

  const devices = await navigator.mediaDevices.enumerateDevices();
  console.log("enumerateDevices():", devices);

  const permission = await navigator.permissions.query({
    name: "camera" as PermissionName,
  });
  console.log('permissions.query({ name: "camera" }):', permission);

  // The full repro on my Github has a working camera selector that renders the selected
  // cam to a canvas, skipped here for brevity
}

main().catch(console.error);

Expected behavior

enumerateDevices() should return an unredacted list of available camera devices, which seems to require the camera permission status (also logged above) to be granted.

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.26200 x86_64 (X64)
    ✔ WebView2: 151.0.4129.93
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.97.1 (8bab26f4f 2026-07-14)
    ✔ cargo: 1.97.1 (c980f4866 2026-06-30)
    ✔ rustup: 1.29.0 (28d1352db 2026-03-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 24.17.0
    - pnpm: 10.33.4
    - npm: 11.13.0

[-] Packages
    - tauri 🦀: git+https://github.com/tauri-apps/tauri?branch=feat%2Fcef#f5bf953fe2a259f2d176491f50ec2930fb73e03d (2.11.5)
    - tauri-build 🦀: git+https://github.com/tauri-apps/tauri?branch=feat%2Fcef#f5bf953fe2a259f2d176491f50ec2930fb73e03d (2.6.3)
    - wry 🦀: 0.55.1, (outdated, latest: 0.56.1)
    - tao 🦀: 0.35.3, (outdated, latest: 0.37.0)
    - @tauri-apps/api  ⱼₛ: 2.11.1
    - @tauri-apps/cli  ⱼₛ: 2.11.4

[-] Plugins
    - tauri-plugin-opener 🦀: 2.5.4
    - @tauri-apps/plugin-opener  ⱼₛ: 2.5.4

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1420/
    - bundler: Vite

Stack trace


Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: cefissues specific to the CEF based runtimestatus: needs triageThis issue needs to triage, applied to new issuestype: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions