How I can know if I have headphones connected to my computer? My goal is to get it using HTML5 + JavaScript.
On the next page shows all audio output devices, but there i
There is no way using any existing API, but one way could be to send a sound out while checking if the microphone picks it up.
This would be a real test for echo, you could use some "welcome" sound and some FFT code to "parse" microphone input and see if the sound you are sending is re-entering the microphone. However it would require quite some fine tuning to be reliable, and will still not catch people with low volume on the speakers or catch people with too loud headphones .. even if, in that case, since they are producing echo, catching them is probably the right thing to do.
I can't remember which conferencing software was actually doing this setup step emitting a melody and checking the feedback (maybe it was Skype early versions?), but it's doable in modern browsers.