How to connect byte array and streaming audio?

I am creating a relay server for my streaming application. Basically, it should work as follows:

  • Customer. Microphone audio stream to the server through sockets.
  • The server receives the stream and possibly temporarily saves it somewhere (not sure)
  • Client B receives the stream from the server and plays it back.

Basically, I have the first part (sending the microphone to the server):

while(isStreaming) { minBufSize = recorder.read(buffer, 0, buffer.length); mSocket.emit("stream", Arrays.toString(buffer)); } 

And the third part is done just by playing the audio:

 mediaplayer.reset(); mediaplayer.setDataSource("http://192.168.1.2:1337/stream"); mediaplayer.prepare(); mediaplayer.start(); 

Now I'm not sure how to hide the incoming byte array and streaming. Here is my current server code:

 var ms = require('mediaserver'); // from server to Client B exports.letsStream = function(req, res, next) { ms.pipe(req, res, "sample_song_music_file.mp3"); }; // from Client A to server exports.handleSocketConnection = function(socket) { console.log("connected"); socket.on('stream', function(data) { var bytes = JSON.parse(data); console.log("GETTING STREAM:" + bytes); }); } 

Any suggestions? How can I pass this byte array directly?

+5
source share
1 answer

The mediaserver module only supports streaming of existing audio, not a live stream. This will not work.

One way to achieve three goals:

0
source

All Articles