Entry
How do I detect the presence of a sound card ?
How do I test if the user can play sound ?
Nov 17th, 2001 14:24
joe denne, Thor Larholm, http://jscript.dk/Jumper/Test/WMP.html
There are several interesting approaches to test if the user has an
enabled sound card on his machine. One could embed a sound and test if
the play() method works inside a try/catch clause.
Another interesting approach to this problem is to use Windows Media
Player. WMP 6.4+ has an IsSoundCardEnabled method that returns a simple
boolean. An example:
<OBJECT ID="Player64" CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-
0080c74c7e95" STYLE="display:none">
</OBJECT>
<SCRIPT>
function HasSound(){
return Player64.IsSoundCardEnabled();
}
</SCRIPT>
<INPUT TYPE="BUTTON" ONCLICK="alert( HasSound() )" VALUE="Test Sound">
The link associated to this article contains a test page where you can
verify this.
---
Could you expand on your first solution please... the second solution
works well, however media player's penetration rate is still below 60%,
making it fairly redundant for use on a wide scale.