我想呼叫一条路线,然后该路线将在浏览器中打开并开始传输视频流。我使用了getUserMedia api。
答案 0 :(得分:0)
您可以使用 Kurento Media Server。。这是目前最好的开源媒体服务器。我已经使用它并实现了实时点对点通话。
它提供了各种各样的预建教程。例如
此外,它在Java,Javascript和NodeJS中提供了不同的风格。
您可以查看详细的文档here
答案 1 :(得分:0)
将此内容添加到您的书架中
<script src="https://cdnjs.cloudflare.com/ajax/libs/peerjs/0.3.9/peer.min.js"></script>
结伴
var peer = new Peer();
连接
var conn = peer.connect('another-peers-id');
// on open will be launch when you successfully connect to PeerServer
conn.on('open', function(){
// here you have conn.id
conn.send('hi!');
});
接收
peer.on('connection', function(conn) {
conn.on('data', function(data){
// Will print 'hi!'
console.log(data);
});
});
所以现在拨打电话就可以了
var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
getUserMedia({video: true, audio: true}, function(stream) {
var call = peer.call('another-peers-id', stream);
call.on('stream', function(remoteStream) {
// Show stream in some video/canvas element.
});
}, function(err) {
console.log('Failed to get local stream' ,err);
});
并回答
var getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia;
peer.on('call', function(call) {
getUserMedia({video: true, audio: true}, function(stream) {
call.answer(stream); // Answer the call with an A/V stream.
call.on('stream', function(remoteStream) {
// Show stream in some video/canvas element.
});
}, function(err) {
console.log('Failed to get local stream' ,err);
});
});
希望这对您有所帮助,但是您可以使用Kurento Media Server https://github.com/ESTOS/kurento-media-server