SimpleCaptcha和wav播放 [英] SimpleCaptcha and wav playback

查看:671
本文介绍了SimpleCaptcha和wav播放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的客户正在使用 SimpleCaptcha 。我的理解是,SimpleCaptcha能够以WAVE格式(.wav)产生音频验证码。后来这些CAPTCHA-s使用HTML5音频标签播放,如下所示:

 < audio controls =controls自动播放> 
< source src =captcha.wav/>
< / audio>

当然这不是跨浏览器兼容的,其中一个原因就是WAVE格式。这个链接建议IE9只支持MP3,而其他大多数浏览器都可以使用OGG和WAVE。进一步的MP3是专利给弗劳恩霍夫?

注意:我们的后端是基于Java的。



<我的问题是我们可能提供给不支持WAVE格式(如IE9)或HTML5音频标签的客户的最佳回退是什么?由于专利问题,我想在服务器端的MP3动态转换不是一个选项。此外,我不知道任何可以做到这一点的Java库...我已经看到很好的解决方案,如 jPlayer ,但他们说:对于跨浏览器的支持,必须提供一个在HTML5和Flash中都可以使用的格式,即mp3,mp4。我没有找到任何可靠的基于Flash的WAVE播放器。

解决方案

在社区其他人的帮助下,我创建了一个Flash按钮,可以将WAV文件从服务器传输到客户端。它与Securimage PHP验证码分发,用于将音频CAPTCHA流式传输到客户端。



您可以简单地使用此Flash按钮,或者下载并修改Flash 源代码,根据相同的代码创建自己的自定义代码。



您可以使用它作为HTML5音频不可用时的后备。



使用示例如下:

 < object type =application / x-shockwave-flash
data =securimage_play.swf?audio_file = / PATH / TO / AUDIO.wav
width =32height =32>
< param name =movievalue =securimage_play.swf?audio_file = / PATH / TO / AUDIO.wav/>
< / object>

您可以将这些附加选项传递给 securimage_play.swf


  • bgcol :Flash按钮的背景色

  • icon_file :指向png图片的网址,显示为Flash按钮上的图标



另一方面,我确实发现微软决定在< audio> 标签中不支持WAV音频,尤其是因为它们IBM率先推出了WAV格式。是的WAV文件比他们支持的其他压缩音频格式更大,但是带宽也增加到无所谓。

希望有帮助。让我知道,如果你试图执行它,并有任何疑问。您可以在此处看到音频流的演示。


Our client is using SimpleCaptcha. My understanding is that SimpleCaptcha is able to produce audio captchas in WAVE format (.wav). Later these CAPTCHA-s are played back using the HTML5 audio tag, something like this:

<audio controls="controls" autoplay>
    <source src="captcha.wav" />
</audio>

Of course this is not cross browser compatible and one of the reasons is the WAVE format. This link suggests that IE9 supports only MP3 while most other browsers are fine with OGG and WAVE. Further MP3 is a patented to... to Fraunhofer?

Note: our back-end is Java based.

My question is what is the best fallback that we may offer to clients that do not support either the WAVE format (e.g. IE9) or the HTML5 audio tag at all? Due to patent issues I guess that dynamic conversion to mp3 on server side is not an option. Further I do not know any java library that may do this... I have seen nice solutions like jPlayer but they say that "For cross-browser support, a format must be supplied that works in both HTML5 and Flash.", i.e. mp3, mp4. I didn't find any reliable flash based WAVE players too.

解决方案

With help from others in the community, I have created a Flash button that can stream WAV files from the server to the client. It is distributed with Securimage PHP Captcha for streaming audio CAPTCHAs to the client.

You could simply take this Flash button, or download and modify the Flash source code to create your own custom one based on the same code.

You could use it as a fallback for when HTML5 audio isn't available.

Example usage would be:

<object type="application/x-shockwave-flash"
        data="securimage_play.swf?audio_file=/PATH/TO/AUDIO.wav"
        width="32" height="32">
    <param name="movie" value="securimage_play.swf?audio_file=/PATH/TO/AUDIO.wav" />
</object>

You can pass these additional options to securimage_play.swf:

  • bgcol: background-color of the Flash button
  • icon_file: URL to a png image to display as the icon on the Flash button

On a side note, I do find Microsoft's decision to not support WAV audio in the <audio> tag strange, especially since they pioneered WAV format with IBM. Yes WAV files are bigger than the other compressed audio formats they support, but bandwidth is also increasing to the point where it doesn't matter.

Hope that helps. Let me know if you try to implement it and have any questions. You can see a demo of the audio streaming here.

这篇关于SimpleCaptcha和wav播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆