Angular

Check Microphone Is Connected Or Not In Angular

Here, we will develop the angular application for checking microphone is connected or not with the device.

Step 1: Create a new Application

ng new check-microphone

Step 2: Install node_modules

yarn install

Step 3: Install below module

yarn add angular-audio-context

Step 4: Import it in the app.module.ts

import { AudioContextModule } from 'angular-audio-context';

 imports: [
    AudioContextModule.forRoot('balanced')
],

Step 5: Write below code in a app.component.ts file

checkMicrophone(){
 navigator.mediaDevices.getUserMedia({ audio: true })
   .then(function (stream) {
     alert('Mic Is Connected');
     
   }).catch(function () {
     alert('Mic Is Not Connected');
     
   });
}

Step 6: Write below code inĀ  app.component.html file

<button (click)="checkMicrophone();">Check Mic</button>

Step 7: Now Run the project

npm start
Liza Godiwala

I'm Liza Godiwala. I started my journey as an Angular Developer to Learning and developing new things in the current IT world. I completed my MCA from Dharamsinh Desai University.

Recent Posts

Testing hk

Testing

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

Operation

Testing

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

2 years ago

TETS NEW

test

2 years ago