我试着用WebRTC组织一个多方视频会议,只是需要对一些事情稍作澄清:
问:我是否需要为会议的每个成员设置一个RTCPeerConnection对象,还是只需要一个?
例如,我目前正在进行双向交流,这很好.
var pc; // single peer connection instance (see startPeerConnection)
startLocalVideo(function (stream) {
//Offer Local video to Remote Server
if (stream) {
if (!pc) {
startPeerConnection();
}
if (pc) {
pc.addStream(stream);
pc.onaddstream = addRemoteStream;
pc.createOffer(function (description) {
pc.setLocalDescription(description, function () {
signal('offer', {
extension: extension,
call: currentcall,
description: description
});
}, failure);
}, function (error) {
console.log("createOffer error: " + error);
});
}
}
});
function startPeerConnection() {
pc = new RTCPeerConnection({
iceServers: [{
url: "stun:stun.l.google.com:19302"
}]
});
pc.onicecandidate = gotLocalIceCandidate;
}发布于 2016-02-12 10:59:32
如果您计划使用mesh网络创建多方呼叫,则所有参与者都将其媒体发送给所有其他参与者。您需要为调用中的每个端点创建一个对等连接对象。
https://stackoverflow.com/questions/35221453
复制相似问题