i have create a socket connection and using that connection sending the binary stream data to server and on server side i am getting the binary data now using that data i want to create a video file and save it on server. i am reached successfully up to getting the binary data now not getting any way to convert it in a video file. please help to achieve .
on server side m using node.js to create socket server and from client side javascript
server side code :
var server = http.createServer(function(request, response) {
//Creating websocket server
});
server.listen(1337, function() { }); // listen to 1337 port
// create the server
wsServer = new WebSocketServer({
httpServer: server
});
// WebSocket server
wsServer.on('request', function(request) {
var connection = request.accept(null, request.origin);
// all messages from client will receive here.
connection.on('message', function(message) {
if (message.type === 'utf8') {
}else if (message.type === 'binary') {
//here i will get the binary data not want to create the video file using this
}
});
connection.on('close', function(connection) {
});
})
client side :
window.WebSocket = window.WebSocket || window.MozWebSocket;
var connection = new WebSocket('ws://localhost:1337');
connection.binaryType = 'arraybuffer';
var options = {
mimeType: 'video/webm;codecs=vp9'
};
mediaRecorder = new MediaRecorder(MediaStream, options);
mediaRecorder.ondataavailable = function(event) {
if (event.data.size > 0) {
recordedChunks.push(event.data);
connection.onopen = function () {
var byteArray = new Uint8Array(event.data);
connection.send(byteArray.buffer);
};
}
};