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

[Log] Error accessing camera – NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. (App.tsx, line 29) NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission running on ubuntu 22.04 LTS #8346

Closed
learncodingforweb opened this issue Dec 6, 2023 · 2 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@learncodingforweb
Copy link

Describe the bug

unable to access, camera using tauri app for following code
`
import { useEffect, useRef } from "react";

const App=()=>{
const ref=useRef(null);

useEffect(() => {
    navigator.mediaDevices.getUserMedia({ video: true, audio: false }).then(stream => {
        console.log(stream);
        if (ref.current) {
            ref.current.srcObject = stream;
        }
    }).catch(error => {
        console.log("Error accessing camera", error);
    });
  }, []);

return(
    <>
        <h1>Home Page</h1>
        <video ref={ref} autoPlay width={320} height={240}/>
    </>
)

}

export default App;

`

Reproduction

created tauri app using

  1. npm create tauri-app@latest
  2. added above mention code
  3. npm run tauri dev

Expected behavior

It should show camera in tauri windows.

Platform and versions

`
uname -a
Linux notebook 6.2.0-37-generic #38~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov  2 18:01:13 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
`
`
npm run tauri info

> [email protected] tauri
> tauri info


[✔] Environment
    - OS: Ubuntu 22.04 X64
    ✔ webkit2gtk-4.0: 2.42.2
    ✔ rsvg2: 2.52.5
    ✔ rustc: 1.74.0 (79e9716c9 2023-11-13)
    ✔ cargo: 1.74.0 (ecb9851af 2023-10-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (default)
    - node: 18.12.1
    - yarn: 1.22.19
    - npm: 8.19.2

[-] Packages
    - tauri [RUST]: 1.5.3
    - tauri-build [RUST]: 1.5.0
    - wry [RUST]: 0.24.6
    - tao [RUST]: 0.16.5
    - tauri-cli [RUST]: 1.4.0
    - @tauri-apps/api [NPM]: 1.5.1
    - @tauri-apps/cli [NPM]: 1.5.7

[-] App
    - build-type: bundle
    - CSP: unset
    - distDir: ../dist
    - devPath: http://localhost:1420/
    - framework: React
    - bundler: Vite
`

Stack trace

[Debug] [vite] connecting... (client, line 229)
[Debug] [vite] connected. (client, line 324)
[Log] Error accessing camera – NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. (App.tsx, line 29)
NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
[Log] Error accessing camera – NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. (App.tsx, line 29)
NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
> Selected Element
< <div id="root">…</div>

Additional context

No response

@learncodingforweb learncodingforweb added status: needs triage This issue needs to triage, applied to new issues type: bug labels Dec 6, 2023
@learncodingforweb learncodingforweb changed the title [Log] Error accessing camera – NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. (App.tsx, line 29) NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. [Log] Error accessing camera – NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission. (App.tsx, line 29) NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission running on ubuntu 22.04 LTS Dec 6, 2023
@FabianLars
Copy link
Member

webkitgtk (The webview used on Linux) doesn't support webrtc (camera / microphone / displays) yet. As far as i know there's no ETA for it but at this point i wouldn't wait for it to be honest.

(Btw, this issue is unrelated to the log plugin)

@FabianLars FabianLars closed this as not planned Won't fix, can't repro, duplicate, stale Dec 6, 2023
@jswhisperer
Copy link

jswhisperer commented Sep 22, 2024

I found this not sure if it helps
config.preferences.setValue(true, forKey: "mediaDevicesEnabled")
src

(tried editing src-tauri/gen/schemas/macOS-schema.json)

and also https://github.com/webrtcHacks/adapter tried running client side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

3 participants