How I can know if I have headphones connected to my computer? HTML5 + JavaScript

前端 未结 2 1626
不知归路
不知归路 2021-02-06 18:41

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

2条回答
  •  囚心锁ツ
    2021-02-06 18:58

    As of today (2019 march) there is no realiable, cross-browser built-in tool to detect whether a user has headphones plugged in. While you theoretically can get audio output destination device and test it for phrases like headset, earphones etc, in a typical case it rather provides you with driver's name, which usually doesn't change when user plugs his earphones in. The usually part makes this approach useless.

提交回复
热议问题