简体   繁体   English

socket.io-stream不公开.to调用

[英]socket.io-stream not exposing .to call

I'm building a camera streaming platform that uses navigator.getUserMedia. 我正在构建一个使用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: 但是,我的Node.JS服务器处理流(并将其发送到其他客户端)会引发此错误:

\n    TypeError: socket_stream(...).to is not a function TypeError:socket_stream(...)。to不是一个函数\n

It seems socket.io-stream isn't exposing the .to function. 似乎socket.io-stream没有公开.to函数。 I know the argument to socket_stream (reference to the socket.io instance) is valid; 我知道socket_stream的参数(对socket.io实例的引用)是有效的; and socket.io-stream's documentation seems to agree with this (there is no mention of .to) 并且socket.io-stream的文档似乎对此表示赞同(没有提及.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. 好吧,没关系(一个月后),我找到了一个死了的简单WebRTC示例 ,该示例向我展示了使用WebRTC的基础知识(没有STUN服务器,这是该项目所需要的),我适应了我的特定需求。 Great job to Shane Tully on that tutorial! Shane Tully在该教程上做得很好!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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