私はwebRTCが初めてで、試してみたいと思っていました。これは、ローカルホストで実行されているすべての下の私のセットアップです。MacOS でセットアップを実行しています
ローカルホスト上で実行されているクロムブラウザcoturnサーバー上の2つのWebクライアント シグナリングメカニズムは、ローカルホスト上でも実行されているsocket.io libを使用してサーバー上で行われます
Web クライアントでリモート オーディオおよびビデオ データを取得できません。
これは私がcoturnをインストールした方法です
brew install coturn
カスタム構成は行っていません。
これが私がcoturnサーバーを実行している方法です
turnserver --no-auth --verbose
これが私がWebサーバーを実行している方法です
node index.js
これは、Chrome ブラウザーで実行される JavaScript の webRTC 構成です。
var pcConfig = { 'iceServers': [ { 'urls': 'turn:localhost:3478', 'credential': 'test', 'username': 'test' } ], iceTransportPolicy: "relay" };
これは、chrome://webrtc-internals/ URL に表示されるエラーです。
icecandidateerror url: turn:localhost:3478?transport=tcp address: [0:0:0:x:x:x:x:x] port: 61077 host_candidate: [0:0:0:x:x:x:x:x]:61077 error_text: TURN allocate request timed out. error_code: 701
これはcoturnの出力ログです
0: log file opened: /var/tmp/turn_21094_2020-05-02.log
0: WARNING: Cannot find config file: turnserver.conf. Default and command-line settings will be used.
0: WARNING: Cannot find config file: turnserver.conf. Default and command-line settings will be used.
0:
RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server
Version Coturn-4.5.1.1 'dan Eider'
0:
Max number of open files/sockets allowed for this process: 32767
0:
Due to the open files/sockets limitation,
max supported number of TURN Sessions possible is: 16000 (approximately)
0:
==== Show him the instruments, Practical Frost: ====
0: TLS supported
0: DTLS supported
0: DTLS 1.2 supported
0: TURN/STUN ALPN supported
0: Third-party authorization (oAuth) supported
0: GCM (AEAD) supported
0: OpenSSL compile-time version: OpenSSL 1.1.1d 10 Sep 2019 (0x1010104f)
0:
0: SQLite supported, default database location is /usr/local/Cellar/coturn/4.5.1.1_1/var/db/turndb
0: Redis is not supported
0: PostgreSQL is not supported
0: MySQL is not supported
0: MongoDB is not supported
0:
0: Default Net Engine version: 1 (UDP listening socket per session)
=====================================================
0: Domain name:
0: Default realm:
0: ERROR:
CONFIG ERROR: Empty cli-password, and so telnet cli interface is disabled! Please set a non empty cli-password!
0: WARNING: cannot find certificate file: turn_server_cert.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because certificate file is not set properly
0: WARNING: cannot find private key file: turn_server_pkey.pem (1)
0: WARNING: cannot start TLS and DTLS listeners because private key file is not set properly
0: NO EXPLICIT LISTENER ADDRESS(ES) ARE CONFIGURED
0: ===========Discovering listener addresses: =========
0: Listener address to use: 127.0.0.1
0: Listener address to use: ::1
0: Listener address to use: 192.168.0.10
0: Listener address to use: 2601:647:4001:73e0:83:ba63:ccbf:4787
0: Listener address to use: 2601:647:4001:73e0:983b:50cc:a7b8:c474
0: Listener address to use: 172.131.240.199
0: Listener address to use: 2001:4998:effd:7801::1041
0: =====================================================
0: Total: 5 'real' addresses discovered
0: =====================================================
0: NO EXPLICIT RELAY ADDRESS(ES) ARE CONFIGURED
0: ===========Discovering relay addresses: =============
0: Relay address to use: 192.168.0.10
0: Relay address to use: 172.131.240.199
0: Relay address to use: 2601:647:4001:73e0:83:ba63:ccbf:4787
0: Relay address to use: 2601:647:4001:73e0:983b:50cc:a7b8:c474
0: Relay address to use: 2001:4998:effd:7801::1041
0: =====================================================
0: Total: 5 relay addresses discovered
0: =====================================================
Cannot create pid file: /var/run/turnserver.pid: Permission denied
0: Cannot create pid file: /var/run/turnserver.pid
0: pid file created: /var/tmp/turnserver.pid
0: IO method (main listener thread): kqueue
0: IPv6: On this platform, I am using alternative behavior of TTL (HOPLIMIT) according to RFC 6156.
0: Wait for relay ports initialization...
0: relay 192.168.0.10 initialization...
0: relay 192.168.0.10 initialization done
0: relay 172.131.240.199 initialization...
0: relay 172.131.240.199 initialization done
0: relay 2601:647:4001:73e0:83:ba63:ccbf:4787 initialization...
0: relay 2601:647:4001:73e0:83:ba63:ccbf:4787 initialization done
0: relay 2601:647:4001:73e0:983b:50cc:a7b8:c474 initialization...
0: relay 2601:647:4001:73e0:983b:50cc:a7b8:c474 initialization done
0: relay 2001:4998:effd:7801::1041 initialization...
0: relay 2001:4998:effd:7801::1041 initialization done
0: Relay ports initialization done
0: IO method (general relay thread): kqueue
0: turn server id=0 created
0: IO method (general relay thread): kqueue
0: turn server id=1 created
0: IO method (general relay thread): kqueue
0: turn server id=2 created
0: IO method (general relay thread): kqueue
0: turn server id=3 created
0: IO method (general relay thread): kqueue
0: turn server id=4 created
0: IO method (general relay thread): kqueue
0: turn server id=5 created
0: IO method (general relay thread): kqueue
0: turn server id=6 created
0: IO method (general relay thread): kqueue
0: turn server id=7 created
0: IO method (general relay thread): kqueue
0: turn server id=8 created
0: IO method (general relay thread): kqueue
0: turn server id=9 created
0: IO method (general relay thread): kqueue
0: turn server id=10 created
0: IO method (general relay thread): kqueue
0: turn server id=11 created
0: IPv4. UDP listener opened on: 127.0.0.1:3478
0: IPv4. UDP listener opened on: 127.0.0.1:3479
0: IPv6. UDP listener opened on: ::1:3478
0: IPv6. UDP listener opened on: ::1:3479
0: IPv4. UDP listener opened on: 192.168.0.10:3478
0: IPv4. UDP listener opened on: 192.168.0.10:3479
0: IPv6. UDP listener opened on: 2601:647:4001:73e0:83:ba63:ccbf:4787:3478
0: IPv6. UDP listener opened on: 2601:647:4001:73e0:83:ba63:ccbf:4787:3479
0: IPv6. UDP listener opened on: 2601:647:4001:73e0:983b:50cc:a7b8:c474:3478
0: IPv6. UDP listener opened on: 2601:647:4001:73e0:983b:50cc:a7b8:c474:3479
0: IPv4. UDP listener opened on: 172.131.240.199:3478
0: IPv4. UDP listener opened on: 172.131.240.199:3479
0: IPv6. UDP listener opened on: 2001:4998:effd:7801::1041:3478
0: IPv6. UDP listener opened on: 2001:4998:effd:7801::1041:3479
socket: Protocol not supported
0: IPv4. TCP listener opened on : 127.0.0.1:3478
socket: Protocol not supported
0: IPv4. TCP listener opened on : 127.0.0.1:3479
socket: Protocol not supported
0: IPv6. TCP listener opened on : ::1:3478
socket: Protocol not supported
0: IPv6. TCP listener opened on : ::1:3479
socket: Protocol not supported
0: IPv4. TCP listener opened on : 192.168.0.10:3478
socket: Protocol not supported
0: IPv4. TCP listener opened on : 192.168.0.10:3479
socket: Protocol not supported
0: IPv6. TCP listener opened on : 2601:647:4001:73e0:83:ba63:ccbf:4787:3478
socket: Protocol not supported
0: IPv6. TCP listener opened on : 2601:647:4001:73e0:83:ba63:ccbf:4787:3479
socket: Protocol not supported
0: IPv6. TCP listener opened on : 2601:647:4001:73e0:983b:50cc:a7b8:c474:3478
socket: Protocol not supported
0: IPv6. TCP listener opened on : 2601:647:4001:73e0:983b:50cc:a7b8:c474:3479
socket: Protocol not supported
0: IPv4. TCP listener opened on : 172.131.240.199:3478
socket: Protocol not supported
0: IPv4. TCP listener opened on : 172.131.240.199:3479
socket: Protocol not supported
0: IPv6. TCP listener opened on : 2001:4998:effd:7801::1041:3478
socket: Protocol not supported
0: IPv6. TCP listener opened on : 2001:4998:effd:7801::1041:3479
0: Total General servers: 12
0: IO method (auth thread): kqueue
0: IO method (auth thread): kqueue
0: IO method (auth thread): kqueue
0: IO method (auth thread): kqueue
0: IO method (auth thread): kqueue
0: IO method (auth thread): kqueue
0: IO method (admin thread): kqueue
0: SQLite DB connection success: /usr/local/Cellar/coturn/4.5.1.1_1/var/db/turndb
6: IPv6. tcp or tls connected to: ::1:51182
6: IPv6. tcp or tls connected to: ::1:51183
6: IPv6. tcp or tls connected to: ::1:51184
6: IPv6. tcp or tls connected to: ::1:51185
6: IPv6. Local relay addr: ::1:58105
6: IPv6. Local relay addr: ::1:52192
6: IPv6. Local relay addr: ::1:59628
6: session 003000000000000001: new, realm=<>, username=<>, lifetime=600
6: session 003000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: IPv6. Local relay addr: ::1:53728
6: session 008000000000000001: new, realm=<>, username=<>, lifetime=600
6: session 002000000000000001: new, realm=<>, username=<>, lifetime=600
6: session 009000000000000001: new, realm=<>, username=<>, lifetime=600
6: session 008000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 002000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 009000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: IPv6. tcp or tls connected to: ::1:51186
6: IPv6. tcp or tls connected to: ::1:51187
6: IPv6. tcp or tls connected to: ::1:51188
6: IPv6. tcp or tls connected to: ::1:51189
6: IPv6. Local relay addr: ::1:58982
6: session 002000000000000002: new, realm=<>, username=<>, lifetime=600
6: session 002000000000000002: realm <> user <>: incoming packet ALLOCATE processed, success
6: IPv6. Local relay addr: ::1:50091
6: IPv6. Local relay addr: ::1:64548
6: IPv6. Local relay addr: ::1:59514
6: session 007000000000000001: new, realm=<>, username=<>, lifetime=600
6: session 007000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 004000000000000001: new, realm=<>, username=<>, lifetime=600
6: session 004000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 005000000000000001: new, realm=<>, username=<>, lifetime=600
6: session 005000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 003000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 008000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 009000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 002000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 004000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 007000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 002000000000000002: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 005000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 003000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 009000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 008000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 002000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 007000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 005000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 004000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
6: session 002000000000000002: realm <> user <>: incoming packet ALLOCATE processed, success
7: session 002000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
7: session 003000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
7: session 008000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
7: session 009000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
7: session 002000000000000002: realm <> user <>: incoming packet ALLOCATE processed, success
7: session 004000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
7: session 007000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
7: session 005000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
9: session 008000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
9: session 002000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
9: session 003000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
9: session 009000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
9: session 002000000000000002: realm <> user <>: incoming packet ALLOCATE processed, success
9: session 007000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
9: session 004000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
9: session 005000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
13: session 003000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
13: session 009000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
13: session 008000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
13: session 002000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
13: session 002000000000000002: realm <> user <>: incoming packet ALLOCATE processed, success
13: session 007000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
13: session 004000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
13: session 005000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
21: session 003000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
21: session 008000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
21: session 009000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
21: session 002000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
21: session 004000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
21: session 002000000000000002: realm <> user <>: incoming packet ALLOCATE processed, success
21: session 007000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
21: session 005000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
29: session 002000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
29: session 003000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
29: session 008000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
29: session 009000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
29: session 002000000000000002: realm <> user <>: incoming packet ALLOCATE processed, success
29: session 007000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
29: session 005000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
29: session 004000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
37: session 002000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
37: session 003000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
37: session 008000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
37: session 009000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
37: session 002000000000000002: realm <> user <>: incoming packet ALLOCATE processed, success
37: session 007000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
37: session 004000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
37: session 005000000000000001: realm <> user <>: incoming packet ALLOCATE processed, success
50: session 003000000000000001: TCP socket closed remotely [::1]:51182
50: session 003000000000000001: usage: realm=<>, username=<>, rp=9, rb=252, sp=9, sb=972
50: session 003000000000000001: closed (2nd stage), user <> realm <> origin <>, local [::1]:3478, remote [::1]:51182, reason: TCP connection closed by client (callback)
50: session 002000000000000001: TCP socket closed remotely [::1]:51183
50: session 002000000000000001: usage: realm=<>, username=<>, rp=9, rb=252, sp=9, sb=972
50: session 003000000000000001: delete: realm=<>, username=<>
50: session 008000000000000001: TCP socket closed remotely [::1]:51184
50: session 008000000000000001: usage: realm=<>, username=<>, rp=9, rb=252, sp=9, sb=972
50: session 008000000000000001: closed (2nd stage), user <> realm <> origin <>, local [::1]:3478, remote [::1]:51184, reason: TCP connection closed by client (callback)
50: session 002000000000000001: closed (2nd stage), user <> realm <> origin <>, local [::1]:3478, remote [::1]:51183, reason: TCP connection closed by client (callback)
50: session 009000000000000001: TCP socket closed remotely [::1]:51185
50: session 009000000000000001: usage: realm=<>, username=<>, rp=9, rb=252, sp=9, sb=972
50: session 008000000000000001: delete: realm=<>, username=<>
50: session 002000000000000001: delete: realm=<>, username=<>
50: session 009000000000000001: closed (2nd stage), user <> realm <> origin <>, local [::1]:3478, remote [::1]:51185, reason: TCP connection closed by client (callback)
50: session 009000000000000001: delete: realm=<>, username=<>
50: session 002000000000000002: TCP socket closed remotely [::1]:51186
50: session 007000000000000001: TCP socket closed remotely [::1]:51187
50: session 002000000000000002: usage: realm=<>, username=<>, rp=9, rb=252, sp=9, sb=972
50: session 004000000000000001: TCP socket closed remotely [::1]:51188
50: session 002000000000000002: closed (2nd stage), user <> realm <> origin <>, local [::1]:3478, remote [::1]:51186, reason: TCP connection closed by client (callback)
50: session 004000000000000001: usage: realm=<>, username=<>, rp=9, rb=252, sp=9, sb=972
50: session 005000000000000001: TCP socket closed remotely [::1]:51189
50: session 007000000000000001: usage: realm=<>, username=<>, rp=9, rb=252, sp=9, sb=972
50: session 002000000000000002: delete: realm=<>, username=<>
50: session 004000000000000001: closed (2nd stage), user <> realm <> origin <>, local [::1]:3478, remote [::1]:51188, reason: TCP connection closed by client (callback)
50: session 005000000000000001: usage: realm=<>, username=<>, rp=9, rb=252, sp=9, sb=972
50: session 007000000000000001: closed (2nd stage), user <> realm <> origin <>, local [::1]:3478, remote [::1]:51187, reason: TCP connection closed by client (callback)
50: session 004000000000000001: delete: realm=<>, username=<>
50: session 005000000000000001: closed (2nd stage), user <> realm <> origin <>, local [::1]:3478, remote [::1]:51189, reason: TCP connection closed by client (callback)
50: session 007000000000000001: delete: realm=<>, username=<>
50: session 005000000000000001: delete: realm=<>, username=<>
私の理解では、Chrome ブラウザーは TURN サーバーの応答を待っていますが、タイムアウトして接続を閉じます。これは正しいです?その場合、TURN サーバーが応答しないのはなぜですか? 私は webRTC が初めてで、何を探すべきかわかりません。ここで私が間違っていること、またはどこで問題を探すべきかについて、誰か助けてもらえますか?
注: を削除するiceTransportPolicy: "relay"
と、ビデオとオーディオのストリームを取得できます。リレーを強制した場合にのみ、ストリームはピア接続に送信されません。