I'm streaming video file from server to client. On the client side i receive Uint8Array and i don't know as use this array for streaming video. what data format to convert it to and how to send it as a video tag so that the file can be played ? The task is to stream an rtsp stream, but first I want to try streaming one video file
server
io.on('connection', socket => {
console.log('conn')
let stream = ss.createStream();
ss(socket).emit('stream', stream);
let readStream = fs.createReadStream(mp4Path);
readStream.pipe(stream);
socket.on('disconnect', () => {
console.log('user disconnect')
})
})
client
const socket = io();
ss(socket).on('stream', function(stream) {
var binaryString = "";
stream.on('data', function(data) {
for(var i = 0; i < data.length; i++) {
binaryString += String.fromCharCode(data[i]);
}
});
stream.on('end', function(data) {
binaryString = "";
});
});