Can I stream microphone audio from client to client using nodejs?

后端 未结 1 1738
刺人心
刺人心 2021-02-15 12:25

I\'m trying to create a realtime voice chat. once a client is holding a button and talks, I want the sound to be sent over the socket to the nodejs backend, then I want to strea

1条回答
  •  借酒劲吻你
    2021-02-15 12:42

    I build something like this on my own a few weeks ago. Problems I ran into (you will at some point):

    • To much Data without reducing bitrate and samplerate (over internet)
    • bad audio quallity without interpolation or a better audio compression
    • Even if its not shown to you, you will get different samplerates from different computers sound cards (my PC = 48kHz, my Laptop = 32Khz) that means you have to write a resampler
    • In WebRTC they reduce audio quallity if a bad internet connection is detected. You can not do this because this is low level stuff!
    • You have to implement this in a fast way because JS will block your frontent if not > use webworkers
    • Audio codex translated to JS are very slow and you will get unexpected results (see one audiocodex question from me: here) I have tried Opus as well, but no good results yet.

    I dont work on this project at the moment but you can get the code at: https://github.com/cracker0dks/nodeJsVoip

    and the working example: (link removed) for multi user voip audio. (Not working anymore! Websocketserver is down!) If you go into settings>audio (on the page) you can choose a higher bit and samplerate for better audioquallity.

    EDIT: Can you tell me why u not want to use WebRTC?

    0 讨论(0)
提交回复
热议问题