3

浏览器: Chrome 62.0.3202.94,(64 位)

操作系统: Ubuntu 16.04

我正在尝试创建数据连接。几个月前我用这段代码做过这个,但现在我不能让它工作。问题是,当我用 调用pc.setRemoteDescriptionanswericeConnectionStatenewtocheckingfailed状态,之后什么也没有发生(Chrome 到 Chrome 的连接)

当我在一台机器(两个单独的浏览器选项卡)上运行此代码时,一切正常。因此,当两个端点都在同一个网络上时,没有问题。

这是连接卡住时的快照(不同网络中的端点):

iceConnectionState: "failed"
iceGatheringState: "complete"
signalingState:"stable"

提供:

v=0
o=- 2693235123136612430 3 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE data
a=msid-semantic: WMS
m=application 45251 DTLS/SCTP 5000
c=IN IP4 89.105.158.245
a=candidate:2795255774 1 udp 2122260223 192.168.1.7 45251 typ host generation 0 network-id 1 network-cost 10
a=candidate:264484875 1 udp 1686052607 89.105.158.245 45251 typ srflx raddr 192.168.1.7 rport 45251 generation 0 network-id 1 network-cost 10
a=candidate:3894397742 1 tcp 1518280447 192.168.1.7 9 typ host tcptype active generation 0 network-id 1 network-cost 10
a=ice-ufrag:t9xZ
a=ice-pwd:eqMc+d4DS9D/yWtM5um9jGzi
a=ice-options:trickle
a=fingerprint:sha-256 A2:8E:9B:D5:48:3F:46:A1:02:8B:42:AE:71:23:4E:68:27:CD:12:C5:2F:18:DA:64:86:08:E2:BA:19:30:1D:F4
a=setup:actpass
a=mid:data
a=sctpmap:5000 webrtc-datachannel 1024

回答:

o=- 8717349184791425430 3 IN IP4 127.0.0.1
s=-
t=0 0
a=group:BUNDLE data
a=msid-semantic: WMS
m=application 24239 DTLS/SCTP 5000
c=IN IP4 145.255.177.124
b=AS:30
a=candidate:1019731727 1 udp 2122260223 192.168.1.104 53848 typ host generation 0 network-id 1 network-cost 10
a=candidate:1917068287 1 tcp 1518280447 192.168.1.104 9 typ host tcptype active generation 0 network-id 1 network-cost 10
a=candidate:3180321211 1 udp 1686052607 145.255.177.124 24239 typ srflx raddr 192.168.1.104 rport 53848 generation 0 network-id 1 network-cost 10
a=ice-ufrag:MkpV
a=ice-pwd:ziXJMu7r/UYnLx1srbUqkXp6
a=ice-options:trickle
a=fingerprint:sha-256 9D:2B:AB:D8:B4:65:5F:86:A6:2A:D8:D0:5A:54:D9:E1:81:B4:6F:21:A4:5D:36:FA:E0:D3:7F:0F:B2:10:8D:3E
a=setup:active
a=mid:data
a=sctpmap:5000 webrtc-datachannel 1024

这是代码:

有两种处理 ICE 候选的方法——涓流方式和非涓流方式。这是它们如何不同的解释。基本上,以一种非涓涓细流的方式,ICE 候选人不是单独发送的,而是聚集在一起并在一个包裹中发送一个报价/答案。我在这里使用非涓流方法。

const signallingServerApi = {...} // api for sending/receiving messages
const iceServers = [ { urls: [ 'stun:stun.l.google.com:19302' ] } ]
let pc
let sdc

// INIT
const = call => () {
  createDataConnection()
  pc.createOffer()
    .then(pc.setLocalDescription)
}

// HELPERS
const createDataConnection = () => {
  pc = new window.RTCPeerConnection({ iceServers })
  pc.ondatachannel = onDataChannel
  pc.onicecandidate = onIceCandidate
  sdc = pc.createDataChannel('sdc')
}

// PC EVENTS HANDLERS
const onDataChannel = (event) => {
  rdc = event.channel
}
const onIceCandidate = (event) => {
  if (event.candidate) return
  const description = event.target.localDescription
  signallingServerApi.send(description)
}

// SIGNALLING SERVER API CALLBACKS
signallingServerApi.onOffer = (offer) => {
  createDataConnection()
  pc.setRemoteDescription(offer)
    .then(pc.createAnswer)
    .then(pc.setLocalDescription)
}
signallingServerApi.onAnswer = (answer) => {
  pc.setRemoteDescription(answer)
}

这是来自 chrome://webrtc-internals/ 的转储

{
 "getUserMedia": [
  {
   "audio": "",
   "origin": "https://olmeo.us",
   "pid": 5535,
   "rid": 11,
   "video": ""
  }
 ],
 "PeerConnections": {
  "5535-1": {
   "constraints": "",
   "rtcConfiguration": "{ iceServers: [stun:stun.l.google.com:19302], iceTransportPolicy: all, bundlePolicy: balanced, rtcpMuxPolicy: require, iceCandidatePoolSize: 0 }",
   "stats": {
    "googLibjingleSession_579639950488086086-googInitiator": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true,true]"
    },
    "bweforvideo-googActualEncBitrate": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"
    },
    "bweforvideo-googAvailableReceiveBandwidth": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"
    },
    "bweforvideo-googAvailableSendBandwidth": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[300000,300000,300000,300000,300000,300000,300000,300000,300000,300000,300000,300000,300000,300000,300000,300000,300000,300000,300000,300000]"
    },
    "bweforvideo-googBucketDelay": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"
    },
    "bweforvideo-googRetransmitBitrate": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"
    },
    "bweforvideo-googTargetEncBitrate": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"
    },
    "bweforvideo-googTargetEncBitrateCorrected": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"
    },
    "bweforvideo-googTransmitBitrate": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]"
    },
    "datachannel_-1-protocol": {
     "startTime": "2017-12-19T14:10:33.510Z",
     "endTime": "2017-12-19T14:10:33.510Z",
     "values": "[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]"
    },
    "datachannel_-1-state": {
     "startTime": "2017-12-19T14:10:33.510Z",
     "endTime": "2017-12-19T14:10:33.510Z",
     "values": "[\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\"]"
    },
    "datachannel_-1-label": {
     "startTime": "2017-12-19T14:10:33.510Z",
     "endTime": "2017-12-19T14:10:33.510Z",
     "values": "[\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\"]"
    },
    "googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F-googDerBase64": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[\"MIIBFTCBvaADAgECAgkA/PxGIi2N1zswCgYIKoZIzj0EAwIwETEPMA0GA1UEAwwGV2ViUlRDMB4XDTE3MTIxODE0MTAxNVoXDTE4MDExODE0MTAxNVowETEPMA0GA1UEAwwGV2ViUlRDMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQ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iIJhUppEGgnEJbmRHZ4enDYDUYsDWfz47DEtsSIqCCvvqIWzAKBggqhkjOPQQDAgNHADBEAiABuB2RUnFUFAAUetxwyLYwr9+hMIuyvCcKpVtX4gkbDgIgSlRZD5NQETFAsm6XWQ2g904Zv4CTlXrbYsTp684NAw0=\",\"MIIBFTCBvaADAgECAgkA/PxGIi2N1zswCgYIKoZIzj0EAwIwETEPMA0GA1UEAwwGV2ViUlRDMB4XDTE3MTIxODE0MTAxNVoXDTE4MDExODE0MTAxNVowETEPMA0GA1UEAwwGV2ViUlRDMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEcKmntD/j3C7fLzVlUZxQU72eEKOUxMvWrqwul+iIJhUppEGgnEJbmRHZ4enDYDUYsDWfz47DEtsSIqCCvvqIWzAKBggqhkjOPQQDAgNHADBEAiABuB2RUnFUFAAUetxwyLYwr9+hMIuyvCcKpVtX4gkbDgIgSlRZD5NQETFAsm6XWQ2g904Zv4CTlXrbYsTp684NAw0=\",\"MIIBFTCBvaADAgECAgkA/PxGIi2N1zswCgYIKoZIzj0EAwIwETEPMA0GA1UEAwwGV2ViUlRDMB4XDTE3MTIxODE0MTAxNVoXDTE4MDExODE0MTAxNVowETEPMA0GA1UEAwwGV2ViUlRDMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEcKmntD/j3C7fLzVlUZxQU72eEKOUxMvWrqwul+iIJhUppEGgnEJbmRHZ4enDYDUYsDWfz47DEtsSIqCCvvqIWzAKBggqhkjOPQQDAgNHADBEAiABuB2RUnFUFAAUetxwyLYwr9+hMIuyvCcKpVtX4gkbDgIgSlRZD5NQETFAsm6XWQ2g904Zv4CTlXrbYsTp684NAw0=\"]"
    },
    "googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F-googFingerprint": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:1f:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\"]"
    },
    "googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F-googFingerprintAlgorithm": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\",\"sha-256\"]"
    },
    "Channel-data-1-googComponent": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]"
    },
    "Channel-data-1-localCertificateId": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:4E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\",\"googCertificate_CB:62:2A:C7:75:C0:6B:1F:48:66:61:5C:FF:C1:00:9C:48:D0:8B:ED:6E:57:F9:FB:DB:4A:9A:85:1F:02:F1:4F\"]"
    },
    "datachannel_1-datachannelid": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]"
    },
    "datachannel_1-protocol": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\",\"\"]"
    },
    "datachannel_1-state": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\",\"connecting\"]"
    },
    "datachannel_1-label": {
     "startTime": "2017-12-19T14:10:59.205Z",
     "endTime": "2017-12-19T14:11:18.194Z",
     "values": "[\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\",\"sdc\"]"
    }
   },
   "updateLog": [],
   "url": "https://olmeo.us/requests"
  }
 },[
 "UserAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36"
}

编辑

当我在 Chrome 和 Firefox 之间建立连接时,我收到一个错误(在 Firefox 中):

ICE 失败,添加 TURN 服务器并查看 about:webrtc 了解更多详情

我在这里测试过的两台机器都可以访问 Stun 服务器,因此候选生成没有问题。我不确定它是否相关,但答案的srflx候选端口不匹配(24239!== 53848)。正常吗?

a=candidate:3180321211 1 udp 1686052607 145.255.177.124 24239 typ srflx raddr 192.168.1.104 rport 53848 generation 0 network-id 1 network-cost 10

我错过了什么?

4

1 回答 1

3

我发现有时在处理收到的报价之前发出接收候选人的信号,这会使 iceConnectionState 失败。您没有使用 addIceCandidate 提供部分代码,因此这只是假设,但您可以尝试在 addIceCandidate 代码之前添加超时。

于 2018-05-04T06:09:39.680 回答