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

[bug] Audio Permission Not Working in Tauri Android App Despite Manifest Declaration #10846

Open
gato25 opened this issue Aug 31, 2024 · 1 comment
Labels
platform: Android status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@gato25
Copy link

gato25 commented Aug 31, 2024

Describe the bug

I'm trying to use navigator.mediaDevices.getUserMedia to record audio. However, I'm consistently getting a "not-allowed" error, even after adding the necessary permission to the AndroidManifest.xml and granting the permission on the device.

  1. Added the following permission to AndroidManifest.xml:
    <uses-permission android:name="android.permission.RECORD_AUDIO" />

  2. Manually allowed the audio permission for the app in the Android settings.

  3. Implemented the audio recording using the following code:

async function startRecording() {
  try {
    const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
    // Further implementation...
  } catch (error) {
    console.error("Error accessing the microphone", error);
  }
}

Are there any additional steps required to properly set up audio permissions in a Tauri Android app?

Reproduction

No response

Expected behavior

No response

Full tauri info output

[✔] Environment
    - OS: Windows 10.0.22621 x86_64 (X64)
    ✔ WebView2: 128.0.2739.54
    ✔ MSVC: Visual Studio Build Tools 2022
    ✔ rustc: 1.80.0 (051478957 2024-07-21)
    ✔ cargo: 1.80.0 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (54dd3d00f 2024-04-24)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.16.0
    - pnpm: 9.6.0
    - npm: 10.8.1
    - bun: 1.1.24

[-] Packages
    - tauri 🦀: 2.0.0-rc.8
    - tauri-build 🦀: 2.0.0-rc.7
    - wry 🦀: 0.42.0
    - tao 🦀: 0.29.1
    - @tauri-apps/api : 2.0.0-rc.4
    - @tauri-apps/cli : 2.0.0-rc.8

[-] Plugins
    - tauri-plugin-shell 🦀: 2.0.0-rc.2
    - @tauri-apps/plugin-shell : 2.0.0-rc.0 (outdated, latest: 2.0.0-rc.1)

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

Stack trace

No response

Additional context

No response

@gato25 gato25 added status: needs triage This issue needs to triage, applied to new issues type: bug labels Aug 31, 2024
@FabianLars
Copy link
Member

Are there any additional steps required to properly set up audio permissions in a Tauri Android app?

As far as i know what you listed here was enough for others in the past 🤔

https://discord.com/channels/616186924390023171/1207729770775838750 / https://discord.com/channels/616186924390023171/1263134040442277898/1263134040442277898

No idea what the issue could be, maybe it's the wrong AndroidManifest file (can't remember if there are multiple) or maybe the way you enabled audio permissions was wrong/not enough. Can you try adding <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> and see if that makes it prompt for permissions?

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

No branches or pull requests

2 participants