How to pipe MediaStream to SocketIO stream?
Asked Answered
Z

0

7

I am trying to capture User media through navigator.mediaDevices.getUserMedia() and then pipe the resultant stream to a socket io stream.

$(function(){
    var socket = io('http://localhost:3000');
    var outstream = ss.createStream();
    navigator.mediaDevices.getUserMedia({audio: true, video: true})
             .then(stream => {
                console.log(stream);
                ss(socket).emit('videoin', outstream);
                stream.pipe(outstream);
            })
        })

But the code is throwing error stream.pipe is not a function. I have already searched a lot on the web but have not got a good answer. There are some answers that suggest using WebRTC instead, but they are old and I think socketio stream didn't exist at that time.

What should I do?

Zitella answered 28/4, 2020 at 16:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.