Reputation:
I'm trying to create an audio captcha system for the visually impaired. I have a system that will glue several wave files together, but I'm having trouble embedding them in ie and firefox.
<script type="text/javascript">
function EvalSound(soundobj)
{
var thissound=document.getElementById(soundobj);
thissound.Play();
}
</script>
<embed src="createaudiocaptcha.php?x=46765" autostart="false" width="0" height="0" id="sound1" enablejavascript="true">
<a href="javascript:EvalSound('sound1')"><img src="gfx/speaker.gif" border="0" alt="Audio capture for visually impaired"></a>
using this works, however ie (vista) will just play the sound straight away, it should wait until the speaker has been clicked. IE on win xp seems to lock up for some reason.
I have tried changing the embed for this:
<object type="application/x-mplayer2" height="0" width="0" id="sound1">
<param name="src" value="createaudiocaptcha.php?x=19329">
<param name="autostart" value="0">
<param name="playcount" value="1">
</object>
however ie on winxp still sems to lock up - ie on vista plays the sound straight away and firefox will not play it saying no play() function.
does anybody know why ie on windows xp would lock up? - Suggestion appreciated
Upvotes: 1
Views: 2780
You will find multiple possible options in the link below ,
http://www.phon.ucl.ac.uk/home/mark/audio/play.htm#
Upvotes: 0
Reputation:
I am doing the SAME thing as you with the SAME script. My IE begged me to install the plugin for Media Player. Once I clicked the ActiveX bar at the top if IE to install it... no more locking up. Check your Security Options in IE and/or update Java to the latest and greatest. For what it's worth... I did get mine working on IE and FF with 5 different sounds once the plugin was installed. Oh... and I put around the lines.... one in front and the /object at the end. Maybe that will help you??!?
Upvotes: 1
Reputation: 71101
Why not only embed the audio file as needed. Write the embed/object tag out with JavaScript only when someone has clicked "I need the audio captcha"
put some tags on the page like:
<a href="javascript:void(0);" onclick="getMeTheAudio();">Please play the audio Captcha</a><br />
<div id="audioCaptcha">
</div>
Then the getMeTheAudio() function fills in the innerHTML of the audioCaptcha div with the embed/object. You could sniff the browser type if you want to be fancy.
Upvotes: 0
Reputation: 41803
Scriptaculos has a pretty good Sound library. You can play and stop with it; it should fulfill your needs.
Upvotes: 0
Reputation: 16848
There's an audio service that essentially does this exact thing called ReCaptcha (http://recaptcha.net/).
You can read a review of the service on ReadWriteWeb if you would like to know more about it.
Google also offers an audio captcha. There's an article on the official Google blog here.
Upvotes: 2