Is there a way of recording audio of streaming broadcast from a webpage?

前端 未结 1 1701
别那么骄傲
别那么骄傲 2021-01-15 17:47

I\'m looking to create webpage for record streaming audio from source (like online radio).

At first I thought of doing something like recording from speakers, but so

相关标签:
1条回答
  • 2021-01-15 18:31

    The sound coming through the system is generally (1) available through one of the TargetDataLines of the Java Sound (sampled) API. Hook into that TargetDataLine & write the bytes directly to disk.

    (Assuming you have the right to do so, of course.)

    See the Capturing Audio lesson in the Java Tutorial for details. See my answer to JavaSound mixer with both Port(s) and DataLine(s)? for source to easily explore the available data lines. It is probably the "Primary Sound Capture Driver" that you need for this.

    Java code must be trusted (or running with no security manager) to eavesdrop on the sound lines.

    1. On some systems Java Sound does not seem to be able to detect all the lines. For those systems, there is little short of a hardware based audio loop-back (e.g. a cable connecting the speaker output back to the microphone) that will fix the problem.
    0 讨论(0)
提交回复
热议问题