Toggle from earpiece to speaker on smartphone

36 views
Skip to first unread message

Anders Both

unread,
May 2, 2022, 8:45:34 AMMay 2
to discuss-webrtc
Dear Group.

Does anynone know how I can toogle between earpiece and speaker on smartphone, via my own javascript button ? 

I need to do an audio-only webrtc application. 

Thanks if anyone have some advice or ideas!.

Best regards

Anders  

Tushar Tripathi

unread,
May 4, 2022, 3:19:11 AMMay 4
to discuss-webrtc
Browsers on phone don't support the setSinkId(https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/setSinkId) API to change between speakers(Firefox does though behind a flag). But what I've seen in Chrome Android is that if you switch the mic, speaker switches as well.
Message has been deleted

Anders Both

unread,
May 4, 2022, 4:40:51 AMMay 4
to discuss-webrtc
  Thank. I get that. Makes sense. 

But on a smartphone can you toogle between the larger handheld microphone and the smaller "hold-on-ear-microphone" ?

I guess that will do the trick with the speaker to, but the various online test for audio source seems to show only one microphone on iphone.

Best regards and thanks again.

Anders

Anders Both

unread,
May 4, 2022, 9:46:50 AMMay 4
to discuss-webrtc
Reply all
Reply to author
Forward
0 new messages