2016-02-05 82 views
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; 
} 

回答

1

如果您打算創建一個使用網狀網絡,其中所有參與者發送他們的媒體的多方通話所有其他參與者。您需要爲呼叫中的每個端點創建一個對等連接對象。