Recording/playback audio on web based page with Java
I've found plenty in javascript etc, and for desktop-based ones in Java, but none for web-based java. Any idea开发者_如何学Cs?
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.
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 .
精彩评论