I am currently developing an Ionic 2 application that requires access to the user's microphone. When working on a web platform, I would typically use the following code snippet to obtain microphone access.
navigator.getUserMedia = (navigator['getUserMedia'] ||
navigator['webkitGetUserMedia'] || navigator['mozGetUserMedia'] ||
navigator['msGetUserMedia']);
(<any>navigator.mediaDevices.getUserMedia({audio:true}).then((stream)=>{...........
While testing the application using "ionic serve," everything functions correctly, and audio input is recorded as expected. However, when running the app on a physical Android device, no sound is captured despite making noise. How can I resolve this issue and successfully access the user's microphone in my Ionic 2 Application?