简体   繁体   English

将视频和音频流发送到服务器

[英]Sending video and audio stream to server

I am trying to develop a system where there are two clients that can video chat to each other from their browsers over a server. 我正在尝试开发一个系统,其中有两个客户端可以通过服务器从浏览器中相互聊天。 First client sends its video stream to the server and the server sends it to the second client. 第一个客户端将其视频流发送到服务器,服务器将其发送到第二个客户端。 Also, server saves client's stream as a video file. 此外,服务器将客户端的流保存为视频文件。

I used this WebRTC example: https://github.com/webrtc/samples/blob/master/src/content/getusermedia/source/js/main.js 我使用了这个WebRTC示例: https//github.com/webrtc/samples/blob/master/src/content/getusermedia/source/js/main.js

Server side; 服务器端;

var express = require('express');
var app = express();
var http = require('http').Server(app);
var io = require('socket.io')(http);

app.use(express.static('C:/source/'));
app.get('/', function(req, res) {
    res.sendFile('C:/source/index.html');
});

io.on('connection', function(socket) {
    console.log('user connected.');

    socket.on('disconnect', function() {
        console.log('user disconnected.');
    });

    socket.on('chat message', function(msg) {
        ?
    });
});

http.listen(3000, function(){
  console.log('listening on *:3000');
});

Client side; 客户端;

var socket = io();

while(streaming) {
   socket.emit(?);
}

I can't understand that from which source I should emit the video + audio stream of the client to the server. 我无法理解从哪个源我应该将客户端的视频+音频流发送到服务器。 If I successfully upload the stream, I will be able to handle it on server side. 如果我成功上传了流,我将能够在服务器端处理它。

You will need a server that is capable of processing WebRTC media. 您将需要一台能够处理WebRTC媒体的服务器。

I suggest looking into Kurento , Janus , Jitsi Videobridge , FreeSWITCH and Asterisk as alternatives. 我建议将KurentoJanusJitsi VideobridgeFreeSWITCHAsterisk作为替代品。

This will require a lot more effort from your end, as all will necessitate learning more about them, WebRTC and real-time media processing. 这需要您付出更多努力,因为所有这些都需要更多地了解它们,WebRTC和实时媒体处理。

If you need this working yesterday and want to put your efforts and focus elsewhere, you should check out some of the vendors listed in this report about WebRTC PaaS . 如果您需要在昨天工作,并希望将您的努力和重点放在其他地方,那么您应该查看本报告中列出的有关WebRTC PaaS的一些供应商。

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

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