views:

1285

answers:

6

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')"></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

+1  A: 

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.

Phil.Wheeler
A: 

Scriptaculos has a pretty good Sound library. You can play and stop with it; it should fulfill your needs.

geowa4
A: 

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.

tyndall
A: 

You will find multiple possible options here >>> http://www.phon.ucl.ac.uk/home/mark/audio/play.htm#

A: 

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??!?

A: 

I think you’ve made some truly interesting points. http://www.zjxhdz.com/ Not too many people would actually think about this the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you did it so well, with so much class. Good one you, man!

brainye