简体   繁体   English

在Java Applet中捕获用户的声卡输出

[英]Capturing the user's sound card output in a Java Applet

I'm looking for a way to capture the sound card output of users and stream it to a red5 server via RTMP in real time. 我正在寻找一种捕获用户声卡输出并通过RTMP实时将其流式传输到Red5服务器的方法。

Using audio redirecting, eg with the Windows Stereo Mix is not an option, as it is pretty difficult to configure and it doesn't work consistently across configurations and Windows versions. 不能选择使用音频重定向,例如Windows Stereo Mix,因为它很难配置,并且在配置和Windows版本之间无法始终如一地工作。

I'm open for all sorts of solution possibilities in this direction - maybe even with JNI/JNA? 我愿意朝这个方向提供各种解决方案-甚至使用JNI / JNA吗?

Thanks for your suggestions! 感谢您的建议!

如果您愿意使用JNI / JNA,为什么不通过C ++或C访问声音驱动程序,这会容易得多,因为无论如何您都将用Java编写接口,但是它们的实现将在C ++或C中进行。

See Capturing Audio in the Java Tutorial. 请参阅Java教程中的捕获音频

An applet will need to be digitally signed as well as trusted by the end user, before it will be possible to intercept the data in the sound lines. 在可能截取声线中的数据之前,必须对小程序进行数字签名并得到最终用户的信任。

If no software or hardware 'audio loop-back' is enabled, it might fail completely (even in a fully trusted applet). 如果未启用任何软件或硬件“音频环回”,则它可能会完全失败(即使在完全受信任的applet中)。

This is not as trivial, as it might seem. 这看起来并不简单。

What you need to do [ part 1 - creating a place to store the info ]: 您需要做什么[第1部分-创建一个存储信息的地方]:

  • describe the server, where to store the file. 描述服务器,文件存储位置。 (for example: Google App Engine) (例如:Google App Engine)
  • describe how you want to store the file. 描述您要如何存储文件。 (for example: datastore) (例如:数据存储)
  • describe how important is the integrity of the data. 描述数据完整性的重要性。 (for example: it's easier to upload a file, with existing upload api, then to stream data. Example Apache FileUpload) (例如:使用现有的上载api上载文件然后流传输数据更容易。示例Apache FileUpload)

Lets say you have maximum size of 1 mb file, (example .ogg) audio file, that you want to upload to a server database. 假设您要上传到服务器数据库的文件(例如.ogg)音频文件的最大大小为1 mb。 If you are going to create a automation uploader, you might aswell create a webpage frontend, that you can manually use. 如果要创建自动化上载器,则还可以创建一个可以手动使用的网页前端。

If you want your questions answered, then form clear question, that people can answer. 如果您想回答问题,然后形成清晰的问题,人们可以回答。 If you do not specify the limits, then it is IMO nonprofessional, and at least I will never write a complex solution. 如果您未指定限制,则说明它是IMO非专业人士,至少我永远不会写一个复杂的解决方案。


Sorry, that my initial answer was not useful for you. 抱歉,我的最初答案对您没有用。 I tried to simplify the problem, but I over simplified it. 我试图简化问题,但是我简化了。 "Everything should be made as simple as possible, but not simpler." A. Einstein.

As a potential solution to your problem, I could recommended: 为了解决您的问题,我建议:

  • Screener - a Java program, that not only streams audio, but also includes screencast video. Screener-一个Java程序,它不仅流音频,还包括截屏视频。 在此处输入图片说明

If it does not solve your problem, then I hope it's at least useful for you. 如果它不能解决您的问题,那么我希望它至少对您有用。

Ok - there is definitely no native way in Java to capture the sound card output out of the browser. 好的-在Java中,绝对没有本地方法可以捕获从浏览器输出的声卡。 It is possible to use the Java Native Interface to write platform-specific code to intercept the line and pass the raw audio data to the applet to further process it. 可以使用Java Native Interface编写特定于平台的代码来截取该行,并将原始音频数据传递到applet进行进一步处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM