简体   繁体   中英

socket.io-stream not exposing .to call

I'm building a camera streaming platform that uses navigator.getUserMedia. The clients seem to broadcast their video streams without error. The code (on clients) for doing so looks like this:

navigator.mediaDevices.getUserMedia({
    audio: false, //We don't need audio at the moment
    video: true
    }).then(function(stream) {
    ss(socket).emit("BroadcastStream", stream);
    }).catch(err) {
    //Code for handling error
    });
However my Node.JS server handling the stream (and sending it to the other client) throws this error:

\n    TypeError: socket_stream(...).to is not a function \n

It seems socket.io-stream isn't exposing the .to function. I know the argument to socket_stream (reference to the socket.io instance) is valid; and socket.io-stream's documentation seems to agree with this (there is no mention of .to)

How would I go around resolving this? EDIT: I am open to suggestions (even using a different method altogether; but leave that as a last resort)

Alright, nevermind (after a month later), I found A Dead Simple WebRTC Example which showed me the basics of using WebRTC (without STUN servers, which I kind of needed for this project), which I adapted to my specific needs. Great job to Shane Tully on that tutorial!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM