HTML5 has an onboard volume detection.
<video controls width="320" height="176" onvolumechange="alert('The volume has been changed')">
This is for the player only.
Is it possible to detect volume from the system? Say a phone. Can I get volume readings of my phone from the mobile browser?
Or can I use JS to detect if the audio jack is plugged in?
Can Volume level be detected for audio out using GetUserMedia?
HTML5 has an onboard volume detection.
<video controls width="320" height="176" onvolumechange="alert('The volume has been changed')">
This is for the player only.
Is it possible to detect volume from the system? Say a phone. Can I get volume readings of my phone from the mobile browser?
Or can I use JS to detect if the audio jack is plugged in?
Can Volume level be detected for audio out using GetUserMedia?
Share Improve this question edited Oct 1, 2014 at 20:20 Cody Raspien asked Oct 1, 2014 at 20:09 Cody RaspienCody Raspien 1,8435 gold badges30 silver badges56 bronze badges 1- Possible duplicate of Javascript: Can you read the systems volume? – clickbait Commented Feb 13, 2019 at 16:04
1 Answer
Reset to default 3Short answer for this is no! This is how web-browsers have been made for a very long time now, and Microsoft/Google/Apple/Mozilla/Opera have done this to avoid exploits through File.IO and such. Actually, we should be thankful for this - as it isolates you puter (with all your personal stuff) from the web-application (which might be hosted on a server with hostile intentions).
Actually, there is one way you could do this, but it would only work for IE users - and the answer is activeX plugins. Now, you could make your javascript create such a plugin and municate with it - but who knows if activeX will be supported by IE in the future.
So per se, there is no way this is achievable with HTML5/Javascript alone - just think of the browser as the OS on which your web-app is running. So Google, Microsoft etc + the rest of the people who decides the HTML5 standards are the ones who decides how much access the developer gets. Camera hardware, GPS hardware etc. we do get to access, but we are not allowed to do whatever we want with that hardware - its not always the developers choice.