3

我使用以下 URL 从 GitHub 下载了由 google WebRTC 团队提供的开源 WebRTC 应用程序演示项目的代码:

https://github.com/webrtc/apprtc

该项目使用 Google Cloud SDK 和 Grunt 运行。

它在我的本地主机上运行,​​端口为 8095,并使用 NgRok 发布。

我安装了它,它的效果很好,但仅适用于内部网络,我尝试实现 TURN 服务器但不成功。

在他们说要更改文件的文档中:

constants.py  

我将其更改为以下代码:

import os

# Deprecated domains which we should to redirect to REDIRECT_URL.
REDIRECT_DOMAINS =  [
  'apprtc.appspot.com', 'apprtc.webrtc.org', 'www.appr.tc'
]
# URL which we should redirect to if matching in REDIRECT_DOMAINS.
REDIRECT_URL = 'https://appr.tc'

ROOM_MEMCACHE_EXPIRATION_SEC = 60 * 60 * 24
MEMCACHE_RETRY_LIMIT = 100

LOOPBACK_CLIENT_ID = 'LOOPBACK_CLIENT_ID'



ICE_SERVER_OVERRIDE  = [
    {
      'url': 'stun:stun.l.google.com:19302'
    },
    {
      'url': 'turn:192.158.29.39:3478?transport=udp',
      'credential': 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
      'username': '28224511:1379330808'
    },
    {
      'url': 'turn:192.158.29.39:3478?transport=tcp',
      'credential': 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
      'username': '28224511:1379330808'
    }
  ]




ICE_SERVER_BASE_URL = 'https://networktraversal.googleapis.com'
ICE_SERVER_URL_TEMPLATE = '%s/v1alpha/iceconfig?key=%s'
ICE_SERVER_API_KEY = os.environ.get('ICE_SERVER_API_KEY')

# Dictionary keys in the collider instance info constant.
WSS_INSTANCE_HOST_KEY = 'host_port_pair'
WSS_INSTANCE_NAME_KEY = 'vm_name'
WSS_INSTANCE_ZONE_KEY = 'zone'
WSS_INSTANCES = [{
    WSS_INSTANCE_HOST_KEY: 'apprtc-ws.webrtc.org:443',
    WSS_INSTANCE_NAME_KEY: 'wsserver-std',
    WSS_INSTANCE_ZONE_KEY: 'us-central1-a'
}, {
    WSS_INSTANCE_HOST_KEY: 'apprtc-ws-2.webrtc.org:443',
    WSS_INSTANCE_NAME_KEY: 'wsserver-std-2',
    WSS_INSTANCE_ZONE_KEY: 'us-central1-f'
}]

WSS_HOST_PORT_PAIRS = [ins[WSS_INSTANCE_HOST_KEY] for ins in WSS_INSTANCES]

# memcache key for the active collider host.
WSS_HOST_ACTIVE_HOST_KEY = 'wss_host_active_host'

# Dictionary keys in the collider probing result.
WSS_HOST_IS_UP_KEY = 'is_up'
WSS_HOST_STATUS_CODE_KEY = 'status_code'
WSS_HOST_ERROR_MESSAGE_KEY = 'error_message'

RESPONSE_ERROR = 'ERROR'
RESPONSE_ROOM_FULL = 'FULL'
RESPONSE_UNKNOWN_ROOM = 'UNKNOWN_ROOM'
RESPONSE_UNKNOWN_CLIENT = 'UNKNOWN_CLIENT'
RESPONSE_DUPLICATE_CLIENT = 'DUPLICATE_CLIENT'
RESPONSE_SUCCESS = 'SUCCESS'
RESPONSE_INVALID_REQUEST = 'INVALID_REQUEST'

IS_DEV_SERVER = os.environ.get('APPLICATION_ID', '').startswith('dev')

BIGQUERY_URL = 'https://www.googleapis.com/auth/bigquery'

# Dataset used in production.
BIGQUERY_DATASET_PROD = 'prod'

# Dataset used when running locally.
BIGQUERY_DATASET_LOCAL = 'dev'

# BigQuery table within the dataset.
BIGQUERY_TABLE = 'analytics'

但仍然无法在外部网络之间进行通信,出现控制台错误:ICE 连接状态更改为:失败

这是我的 chrome://webrtc-internals 输出:

https://363b9c63.ngrok.io/r/004936951, { iceServers: [], iceTransportPolicy: all, bundlePolicy: max-bundle, rtcpMuxPolicy: require, iceCandidatePoolSize: 0 },

Time    Event
13.2.2018, 21:08:08 
addStream
13.2.2018, 21:08:08 
createOffer
13.2.2018, 21:08:08 negotiationneeded
13.2.2018, 21:08:08 
createOfferOnSuccess
13.2.2018, 21:08:08 
setLocalDescription
13.2.2018, 21:08:08 
signalingstatechange
13.2.2018, 21:08:08 setLocalDescriptionOnSuccess
13.2.2018, 21:08:08 
icegatheringstatechange
13.2.2018, 21:08:08 
icecandidate (host)
13.2.2018, 21:08:08 
icecandidate (host)
13.2.2018, 21:08:08 
icecandidate (host)
13.2.2018, 21:08:08 
icecandidate (host)
13.2.2018, 21:08:08 
icecandidate (host)
13.2.2018, 21:08:08 
icecandidate (host)
13.2.2018, 21:08:09 
icecandidate (host)
13.2.2018, 21:08:09 
icecandidate (host)
13.2.2018, 21:08:09 
icecandidate (host)
13.2.2018, 21:08:09 
icecandidate (host)
13.2.2018, 21:08:09 
icecandidate (host)
13.2.2018, 21:08:09 
icecandidate (host)
13.2.2018, 21:08:09 
icegatheringstatechange
13.2.2018, 21:09:20 
setRemoteDescription
13.2.2018, 21:09:20 
addIceCandidate (host)
13.2.2018, 21:09:20 
addIceCandidate (host)
13.2.2018, 21:09:20 
signalingstatechange
13.2.2018, 21:09:20 
iceconnectionstatechange
13.2.2018, 21:09:20 
onAddStream
13.2.2018, 21:09:20 setRemoteDescriptionOnSuccess
13.2.2018, 21:09:36 
iceconnectionstatechange
Stats Tables
googTrack_4c6e7e30-f429-41bc-a283-ffb2e4a12383 (googTrack)
googTrack_3225dba0-c46b-4169-86fe-221b9464cc61 (googTrack)
googLibjingleSession_399041596204088920 (googLibjingleSession)
bweforvideo (VideoBwe)
googCertificate_1D:A9:01:31:DB:24:0E:B1:22:D8:A5:1F:44:9B:22:84:D8:25:60:DE:B2:10:B3:08:B6:D6:63:80:89:27:68:E5 (googCertificate)
Channel-audio-1 (googComponent)
ssrc_3643280748_send (ssrc)
ssrc_3936871711_send (ssrc)
googTrack_7eb768fd-dd5a-4c4c-ada8-b9e1d539d867 (googTrack)
googTrack_1ceb9e2e-7a66-4c6d-b49d-e0b969415118 (googTrack)
Conn-audio-1-0 (googCandidatePair)
Cand-QTIxLw5A (localcandidate)
Cand-40/xeX4y (remotecandidate)
Conn-audio-1-1 (googCandidatePair)
Cand-4ohU6a7F (remotecandidate)
Conn-audio-1-2 (googCandidatePair)
Cand-qUBezng5 (localcandidate)
Conn-audio-1-3 (googCandidatePair)
Conn-audio-1-4 (googCandidatePair)
Cand-tA5Vubib (localcandidate)
Conn-audio-1-5 (googCandidatePair)
ssrc_3046207950_recv (ssrc)
ssrc_3017098662_recv (ssrc)
Stats graphs for bweforvideo (VideoBwe)
Stats graphs for ssrc_3643280748_send (ssrc) (audio)
cname:t09jrVcXtatu5gPI
msid:450695b0-d46b-4566-8386-40c7339f109a 4c6e7e30-f429-41bc-a283-ffb2e4a12383
mslabel:450695b0-d46b-4566-8386-40c7339f109a
label:4c6e7e30-f429-41bc-a283-ffb2e4a12383
Stats graphs for ssrc_3936871711_send (ssrc) (video)
cname:t09jrVcXtatu5gPI
msid:450695b0-d46b-4566-8386-40c7339f109a 3225dba0-c46b-4169-86fe-221b9464cc61
mslabel:450695b0-d46b-4566-8386-40c7339f109a
label:3225dba0-c46b-4169-86fe-221b9464cc61
Stats graphs for Conn-audio-1-0 (googCandidatePair)
Stats graphs for Cand-QTIxLw5A (localcandidate)
Stats graphs for Cand-40/xeX4y (remotecandidate)
Stats graphs for Conn-audio-1-1 (googCandidatePair)
Stats graphs for Cand-4ohU6a7F (remotecandidate)
Stats graphs for Conn-audio-1-2 (googCandidatePair)
Stats graphs for Cand-qUBezng5 (localcandidate)
Stats graphs for Conn-audio-1-3 (googCandidatePair)
Stats graphs for Conn-audio-1-4 (googCandidatePair)
Stats graphs for Cand-tA5Vubib (localcandidate)
Stats graphs for Conn-audio-1-5 (googCandidatePair)
Stats graphs for ssrc_3046207950_recv (ssrc)
cname:QR/GiCZZOxrOJ/9e
msid:FxFjhc5PJ3xgeUp2cVAJPKaP3KMFiolDmLOU 7eb768fd-dd5a-4c4c-ada8-b9e1d539d867
mslabel:FxFjhc5PJ3xgeUp2cVAJPKaP3KMFiolDmLOU
label:7eb768fd-dd5a-4c4c-ada8-b9e1d539d867
Stats graphs for ssrc_3017098662_recv (ssrc) (video)
cname:QR/GiCZZOxrOJ/9e
msid:FxFjhc5PJ3xgeUp2cVAJPKaP3KMFiolDmLOU 1ceb9e2e-7a66-4c6d-b49d-e0b969415118
mslabel:FxFjhc5PJ3xgeUp2cVAJPKaP3KMFiolDmLOU
label:1ceb9e2e-7a66-4c6d-b49d-e0b969415118
4

0 回答 0