【问题标题】:I was trying to do video conferencing with webRTC. This works within the local network but fails on different network我试图用 webRTC 进行视频会议。这在本地网络中有效,但在不同的网络上失败
【发布时间】:2020-08-06 11:37:45
【问题描述】:

我曾尝试使用 SSL 连接不同的网络,但在创建优惠时,它会将(调用者的)公共 ip 作为本地 ip 127.0.0.1。因此,前进无法连接到其他对等方。 [https://www.tutorialspoint.com/webrtc/webrtc_security.htm]。

callBtn.addEventListener("click", function () {
console.log("Intiating the Call") 
var callToUsername = callToUsernameInput.value;
 //console.log("Intiate", yourConn)
if (callToUsername.length > 0) {
  connectedUser = callToUsername;
    
  // create an offer 
  yourConn.createOffer(function (offer) { 
     send({ 
        type: "offer", 
        offer: offer 
     }); 
     console.log("Setting local description")
     yourConn.setLocalDescription(offer); 
     console.log(offer)
        
     }, function (error) { 
     alert("Error when creating an offer"); 
    });  
   } 
  })

Picking local address instead of public address while creating offer

我该如何解决这个问题? 提前致谢

【问题讨论】:

    标签: javascript ssl webrtc


    【解决方案1】:

    您需要在 webrtc 参数中设置 STUN 和/或 TURN 服务器。这使您可以跨网络连接。

    【讨论】:

    • 我已经在使用 google stun 服务器来公开我的机器,但由于某种原因,每当我尝试调用其他对等方时,默认情况下创建的报价使用本地 ip。谢谢@Drik V
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多