使用 Java 在基于网页的页面上录制/播放音频

发布于 2024-10-16 02:25:02 字数 84 浏览 7 评论 0原文

我在 javascript 等方面找到了大量的内容,并且在 Java 中找到了基于桌面的内容,但没有找到基于 Web 的 java 的内容。有什么想法吗?

I've found plenty in javascript etc, and for desktop-based ones in Java, but none for web-based java. Any ideas?

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

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

发布评论

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

评论(2

夕色琉璃 2024-10-23 02:25:02

要全面访问 Java Sound API,请参阅 javax.sound.sampled 包

有关如何使用API。

要录制声音,小程序需要(由您)进行数字签名并受信任(由最终用户 - 在启动时提示时)。

丹尼尔对网页中的声音提出了很好的观点。用户普遍讨厌它。确保您的小程序在用户请求之前不会尝试播放任何声音。将音量设置为相对较低的音量。

For comprehensive access to the Java Sound API, look to the javax.sound.sampled package.

See the Sound Trail of the Java Tutorial for details on how to use the API.

To record sound, the applet would need to be digitally signed (by you) and trusted (by the end user - when prompted at start-up).

Daniel made a good point about sound in web pages. Users generally hate it. Make sure your applet does not attempt to play any sound until requested by the user. Set the volume to a relatively low one.

疯了 2024-10-23 02:25:02

我相信您可以创建一个小程序,然后将其嵌入到网页中。而且小程序能够播放任何你想要的内容,甚至无需用户授权(据我记得,这是 JVM 沙箱允许的)。 Applet 类甚至有专门的方法: Applet.newAudioClip 。

I believe you can create an applet, which then is embedded into web page. And applets are capable of playing whatever you want, even without authorisation from the user (as far as I remember, it is allowed by JVM sandbox). Applet class even has dedicated method for this: Applet.newAudioClip .

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