如何从浏览器捕获音频?

发布于 2024-09-28 19:36:03 字数 148 浏览 1 评论 0原文

我的客户需要让用户从浏览器录制消息,然后将该消息导出为音频文件(例如 WAV)。

如何最好地实现这一点? Flash、Java、HTML5?我所说的“最好”是指易于实施且得到广泛支持的东西。

人们使用 HTML5 的体验如何?

谢谢!

My client needs to let a user record a message from the browser, then export the message as an audio file (e.g., WAV).

How is this best accomplished? Flash, Java, HTML5? By best, I mean something that is straightforward to implement and also broadly supported.

What are people's experiences using HTML5?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

最单纯的乌龟 2024-10-05 19:36:03

Flash 是一种选择,但您需要一个媒体流服务器(Adobe Media Server、Wowza、Red5)。无法在 Flash 上捕获音频并将其本地存储到文件中。

如果您愿意使用 Java 小程序,有多种解决方案。所有这些都需要访问本地文件系统,并将要求用户提供额外的权限。例如,尝试 http://www.javasonics.com/ 或 Google“小程序录制音频"。

更新:自 Flash 10.0 起,可以选择将麦克风与 SampleDataEvent.SAMPLE_DATA 一起使用。这可以访问来自麦克风的原始音频数据。请参阅此项目以了解实施情况:http://code.google.com/p/micrecorder/

Flash is one option but you need a media streaming server (Adobe Media Server, Wowza, Red5). There is no way to capture and store audio on Flash locally to a file.

If you are willing to go with Java applets there are multiple solutions. All of them require access to local filesystem and will ask users for additional permissions. For example try http://www.javasonics.com/ or Google "applet record audio".

Update: since Flash 10.0 there is option to use Microphone with SampleDataEvent.SAMPLE_DATA. This gives access to raw audio data from microphone. See this project for implementation: http://code.google.com/p/micrecorder/

乖乖哒 2024-10-05 19:36:03

好吧,我怀疑 HTML5 的这种功能非常不标准,而且浏览器支持也会有很大差异(许多浏览器不包含任何支持)。

Java 不像 Flash 那样流行,而且很多人根本没有 JRE。

所以总而言之,在这种情况下我会选择 Flash 解决方案。在资源允许的情况下,也许在某些有限的情况下可以使用 HTML5 回退。

Well I suspect that such a feature of HTML5 would be pretty non-standard, and the browser support would differ a lot (with many browsers not including any).

Java is not as popular as flash and there are many people who don't have JRE's at all.

So all in all I would go for the Flash solution in this case. And maybe with an HTML5 fallback for some limited cases, shall resources allow.

梦断已成空 2024-10-05 19:36:03

假设您的意思是“导出”到服务器,这里是一个不需要 Flash 媒体服务器的开源 Flash 解决方案:

https://code.google.com/p/wami-recorder/

录音通过 HTTP post 传输到您选择的服务器端技术。在最简单的情况下,您可以使用 4 行 PHP 代码捕获并保存音频:

<? 
$content = file_get_contents('php://input');
$fh = fopen('output.wav', 'w') or die("can't open file");
fwrite($fh, $content);
fclose($fh);
?>

至于 HTML5 支持,请关注 getUserMedia()

Assuming you mean "export" to a server, here is an open-source Flash solution that does NOT require a flash media server:

https://code.google.com/p/wami-recorder/

The recording is transferred via HTTP post to a server-side technology of your choosing. In the simplest case, you can capture and save audio with 4 lines of PHP code:

<? 
$content = file_get_contents('php://input');
$fh = fopen('output.wav', 'w') or die("can't open file");
fwrite($fh, $content);
fclose($fh);
?>

As for HTML5 support, keep an eye on getUserMedia()

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文