Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger microphone permission popup on chrome (javascript) [duplicate]

How can i trigger this modal on javascript button click

enter image description here

like image 462
Hakan Avatar asked Jun 28 '18 08:06

Hakan


People also ask

How do I turn on microphone permissions first?

Allow access to microphone and camera on Android devicesSelect 'Settings > Apps > LINE WORKS' on your device. Select 'Permissions' in App info. Allow access to 'Microphone', 'Phone', and 'Camera'.

How do I grant microphone permissions to make calls?

Here's how: Select Start > Settings > Privacy > Microphone . In Allow access to the microphone on this device, select Change and make sure Microphone access for this device is turned on.

Why isn't Chrome picking up my mic?

Restart your Chrome browser, then re-open Chrome microphone settings (chrome://settings/content/microphone) and toggle back on 'Ask before accessing', as shown below.


1 Answers

You need to get the permission using the navigator object.

navigator.mediaDevices.getUserMedia({ audio: true })
      .then(function(stream) {
        console.log('You let me use your mic!')
      })
      .catch(function(err) {
        console.log('No mic for you!')
      });

Also you need to run it on HTTPS and on a website instead of using IP addresses

like image 188
Saransh Kataria Avatar answered Sep 20 '22 22:09

Saransh Kataria