Send chunks from MediaRecorder to server and play it back in the browser

后端 未结 3 906
温柔的废话
温柔的废话 2021-02-09 06:28

With the following code in NodeJS I\'m able to play a webm file served from server:

app.get(\'/video\', function(req, res){
    res.writeHead(200,{
        \'Con         


        
3条回答
  •  生来不讨喜
    2021-02-09 07:13

    SFMediaStream could help you splitting media stream into chunk and play it back to the browser, or maybe on the server's speaker for Raspberry. And also adding effect on your stream, it would be fun enough to try the available effects.

    //* Broadcaster
    var presenterMedia = new ScarletsMediaPresenter(/*{options}*/);
    
    // Send the packet below somewhere
    presenterMedia.onRecordingReady = function(bufferHeader){};
    presenterMedia.onBufferProcess = function(packet){};
    
    //* Streamer
    var audioStreamer = new ScarletsAudioStreamer();
    audioStreamer.playStream();
    
    // Receive from somewhere
    audioStreamer.setBufferHeader(/* bufferHeader */);
    audioStreamer.receiveBuffer(/* packet */);
    

    There are some example on the repository if you want more detail on how to use it.

提交回复
热议问题