My ear speaker doesn't detected in my Angular app (using enumerateDevices)

Viewed 191

I am building a project with Ionic 5 / Angular. I want to build a voice call app, which needs to access my phone ear speaker, not the loudspeaker.

The problem is when I fetch my device's audio output using enumerateDevices(), I don't find any other audio output besides the default audio output (the loudspeaker itself).

IO Devices

I want to attach the HTMLMediaElement using .setSinkId() to the ear speaker's device ID, but didn't find it. Is there any native plugin or workaround for this? Or is it just my phone that doesn't support it? Currently, I am using Samsung Galaxy A51.

Thank you.

1 Answers

Check this Plugin: Github Repo

NPM : Npm LInk

Usage:

AudioToggle.setAudioMode(AudioToggle.SPEAKER);
// or
AudioToggle.setAudioMode(AudioToggle.EARPIECE);
Related