question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trying to record audio, DOMException: Permission denied

See original GitHub issue

This is a follow-up to #802. Here’s a tiny sample app I made with Vue and Capacitor 1.0.0-beta.8 that tries to open an audio source and play it back out the speaker.

<template>
  <div>
    <p>Hello, world!</p>
    <audio ref="audioOut" autoplay controls style="display: none;"></audio>
  </div>
</template>

<script>
export default {
  async mounted() {
    const stream = await navigator.mediaDevices.getUserMedia({audio: true, video: false});
    this.$refs.audioOut.srcObject = stream;
  },
}
</script>

I have also added <uses-permission android:name="android.permission.RECORD_AUDIO" /> to android/app/src/main/AndroidManifest.xml

When I install this on my Phone (OnePlus 5, Android 8.1) I get no audio playback, and the Chrome USB debugger, I see DOMException: Permission Denied. I can retrigger than error by running navigator.mediaDevices.getUserMedia({audio: true, video: false}) from the Chrome console.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
jcesarmobilecommented, Oct 7, 2018

Can you try also adding <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>? As I pointed out on #802 it’s also necessary for getting the audio recording. I have that one and can’t reproduce.

0reactions
ionitron-bot[bot]commented, Nov 11, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google chrome DOMException: Permission denied by ...
I had to go to Site Settings -> View Permissions and Data stored across all sites -> Find my Site -> Click Reset...
Read more >
Microphone/Camera "Permission denied" message - Mac
If your browser's Microphone/Camera permissions are not properly set, you will see “Permission denied” on the classroom login screen.
Read more >
DOMException: could not start audio source when trying to ...
What went wrong? When we try to access it we get the following error: `DOMException: could not start audio source`
Read more >
How to solve "Permission to use microphone denied" error
If you see the following error below, it means Dictanote cannot access your microphone. In this article, we present two methods, both of......
Read more >
MediaDevices.getUserMedia() - Web APIs | MDN
If the user denies permission, or matching media is not available, ... async function getMedia(constraints) { let stream = null; try ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found