Get live streaming audio from NodeJS server to clients

前端 未结 2 1356
臣服心动
臣服心动 2021-01-31 20:44

I need to have a real time live audio stream from 1 client to a server to multiple listener clients.

Currently I have the recording from the client working and stream t

2条回答
  •  醉酒成梦
    2021-01-31 21:30

    You could change audio src dynamically as follows (assuming mp3 type):

    
    

    Call following function whenever, socket event is received :

    function updateSource() { 
            var audio = document.getElementById('audio');
    
            var source = document.getElementById('mp3Source');
            source.src= ;
    
            audio.load(); //call this to just preload the audio without playing
            audio.play(); //call this to play the song right away
        }
    

提交回复
热议问题