2015-03-11 12 views
5

belirleyin, tersi client2 tarafından kullanılır client1 tarafından verilen ve hangi ICE adayı bulmak için herhangi bir yolu var mı? hepsi:WebRTC: Bir webrtc uygulaması var ve iki istemcileri (<code>client1</code> ve <code>client2</code>) diyelim seçilen BUZ aday

Senaryo ... her zaman bu öğrenmek için çünkü ben hem istemcilerde wireshark kullanmak zorunda, ben sdp yardımcı olabilecek okuma düşündüm, ama olası tüm adayları verir, yanlış İstemci1'in UDP bağlantı noktası engellendi (test amacıyla beni engelledi).
istemci1 SDP:

... 
a=rtcp:49407 IN IP4 <client1's IP> 
a=candidate:3864409487 1 udp 2122194687 <client1's IP> 49407 typ host generation 0 // this would never work, since the udp ports are blocked... 
a=candidate:3864409487 2 udp 2122194687 <client1's IP> 49407 typ host generation 0 
a=candidate:2832583039 1 tcp 1518214911 <client1's IP> 0 typ host tcptype active generation 0 
a=candidate:2832583039 2 tcp 1518214911 <client1's IP> 0 typ host tcptype active generation 0 
a=candidate:973648460 1 udp 25042687 <TURN server IP> 64790 typ relay raddr <Proxy IP> rport 39963 generation 0 
a=ice-ufrag:YSvrOiav8TglpCWD 
... 
+3

Kontrol dışarı Konuyu: https://groups.google.com/d/msg/discuss-webrtc/-VReEXf9RBM/h91i7CD-oJ8 J –

cevap

3

Eh, getConnectionDetails, ateş ve krom hem de son sürümlerini çalışır yazdım başka bir soru

için benim answer alınıp kod aşağıda parçasını test döndüren bir bağlantı detayları giderir vaadi:

function getConnectionDetails(peerConnection){ 


    var connectionDetails = {}; // the final result object. 

    if(window.chrome){ // checking if chrome 

    var reqFields = [ 'googLocalAddress', 
         'googLocalCandidateType', 
         'googRemoteAddress', 
         'googRemoteCandidateType' 
        ]; 
    return new Promise(function(resolve, reject){ 
     peerConnection.getStats(function(stats){ 
     var filtered = stats.result().filter(function(e){return e.id.indexOf('Conn-audio')==0 && e.stat('googActiveConnection')=='true'})[0]; 
     if(!filtered) return reject('Something is wrong...'); 
     reqFields.forEach(function(e){connectionDetails[e.replace('goog', '')] = filtered.stat(e)}); 
     resolve(connectionDetails); 
     }); 
    }); 

    }else{ // assuming it is firefox 
    return peerConnection.getStats(null).then(function(stats){ 
     var selectedCandidatePair = stats[Object.keys(stats).filter(function(key){return stats[key].selected})[0]] 
      , localICE = stats[selectedCandidatePair.localCandidateId] 
      , remoteICE = stats[selectedCandidatePair.remoteCandidateId]; 
     connectionDetails.LocalAddress = [localICE.ipAddress, localICE.portNumber].join(':'); 
     connectionDetails.RemoteAddress = [remoteICE.ipAddress, remoteICE.portNumber].join(':'); 
     connectionDetails.LocalCandidateType = localICE.candidateType; 
     connectionDetails.RemoteCandidateType = remoteICE.candidateType; 
     return connectionDetails; 
    }); 

    } 
} 


//usage example: 
getConnectionDetails(pc).then(console.log.bind(console)); 
+0

I googLocalCandidateType''' '' 'için' '' googRemoteCandidateType''' ve '' 'relay''' için' '' prflx''' var. Prflx'' nin ne anlama geldiğini biliyor musunuz? –

+0

@anand kontrol etmek zorundayım ama bence bu buzlu buz adayı – mido

İlgili konular