1
我試着使用的WebRTC建立一個多黨視頻會議,只是需要的東西一點點澄清:的WebRTC:多方視頻會議
Q)我需要對本次會議的各成員的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;
}