Closed irajsb closed 2 years ago
The reason I'm asking this is because we cannot connect to it (its in aws) .engine to signal seems good and connected but browser cannot connect even tough it receives tracks .
peer-stream.js:116 signal: ws://13.51.237.138:88/hello
index.js:7 ✅ connected to ws://13.51.237.138:88/hello
peer-stream.js:363 sending offer: RTCSessionDescription
peer-stream.js:322 sending candidate: RTCIceCandidate
peer-stream.js:322 sending candidate: RTCIceCandidate
peer-stream.js:322 sending candidate: RTCIceCandidate
peer-stream.js:310 Got audio track: RTCTrackEventisTrusted: truebubbles: falsecancelBubble: falsecancelable: falsecomposed: falsecurrentTarget: RTCPeerConnection {localDescription: RTCSessionDescription, currentLocalDescription: RTCSessionDescription, pendingLocalDescription: null, remoteDescription: RTCSessionDescription, currentRemoteDescription: RTCSessionDescription, …}defaultPrevented: falseeventPhase: 0path: []receiver: RTCRtpReceiver {track: MediaStreamTrack, transport: RTCDtlsTransport, rtcpTransport: null, playoutDelayHint: 0}returnValue: truesrcElement: RTCPeerConnection {localDescription: RTCSessionDescription, currentLocalDescription: RTCSessionDescription, pendingLocalDescription: null, remoteDescription: RTCSessionDescription, currentRemoteDescription: RTCSessionDescription, …}streams: [MediaStream]target: RTCPeerConnection {localDescription: RTCSessionDescription, currentLocalDescription: RTCSessionDescription, pendingLocalDescription: null, remoteDescription: RTCSessionDescription, currentRemoteDescription: RTCSessionDescription, …}timeStamp: 1297.1000000014901track: MediaStreamTrack {kind: 'audio', id: '4c71d6eb-671d-45a7-9a86-11ba9d97ecb5', label: '4c71d6eb-671d-45a7-9a86-11ba9d97ecb5', enabled: true, muted: false, …}transceiver: RTCRtpTransceiver {mid: '0', sender: RTCRtpSender, receiver: RTCRtpReceiver, stopped: false, direction: 'recvonly', …}type: "track"[[Prototype]]: RTCTrackEvent
peer-stream.js:310 Got video track: RTCTrackEvent
peer-stream.js:183 Got answer: RTCSessionDescription
peer-stream.js:190 Got candidate: RTCIceCandidate
peer-stream.js:190 Got candidate: RTCIceCandidateaddress: "172.31.25.43"candidate: "candidate:376876594 1 tcp 1518280447 172.31.25.43 60369 typ host tcptype passive generation 0 ufrag BHI6 network-id 1 network-cost 50"component: "rtp"foundation: "376876594"port: 60369priority: 1518280447protocol: "tcp"relatedAddress: nullrelatedPort: nullsdpMLineIndex: 0sdpMid: "0"tcpType: "passive"type: "host"usernameFragment: null[[Prototype]]: RTCIceCandidate
peer-stream.js:322 sending candidate: RTCIceCandidateaddress: "3.66.178.95"candidate: "candidate:842163049 1 udp 1677729535 3.66.178.95 51250 typ srflx raddr 0.0.0.0 rport 0 generation 0 ufrag 1Tmh network-cost 999"component: "rtp"foundation: "842163049"port: 51250priority: 1677729535protocol: "udp"relatedAddress: "0.0.0.0"relatedPort: 0sdpMLineIndex: 0sdpMid: "0"tcpType: nulltype: "srflx"usernameFragment: "1Tmh"[[Prototype]]: RTCIceCandidate
I also edited these lines:
// sent to Unreal Engine as initial signal
ws.send(
JSON.stringify({
type: "config",
peerConnectionOptions: {
iceServers: [{ urls: ["stun:34.250.222.95:19302"] }],
},
})
);
setupPeerConnection() {
this.pc.close();
this.pc = new RTCPeerConnection({
sdpSemantics: "unified-plan",
iceServers: [
{
urls: [
"stun:stun.l.google.com:19302",
"stun:stun1.l.google.com:19302",
"stun:stun2.l.google.com:19302",
"stun:stun3.l.google.com:19302",
"stun:stun4.l.google.com:19302",
],
},
],
});
I made an turn server using
# Copyright Epic Games, Inc. All Rights Reserved.
pushd "$( dirname "${BASH_SOURCE[0]}" )"
bash Install_CoTurn.sh
localip=$(curl http://169.254.169.254/latest/meta-data/local-ipv4)
publicip=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)
echo "Private IP: $localip"
echo "Public IP: $publicip"
turnusername="PixelStreamingUser"
turnpassword="AnotherTURNintheroad"
realm="PixelStreaming"
process="turnserver"
arguments="-p 19303 -r $realm -X $publicip -E $localip -L $localip --no-cli --no-tls --no-dtls --pidfile /var/run/turnserver.pid -a -v -n -u ${turnusername}:${turnpassword}"
# Add arguments passed to script to arguments for executable
arguments+=" $@"
pushd ../..
echo "Running: $process $arguments"
# pause
sudo $process $arguments &
popd
popd
script and I edited peer stream as such
setupPeerConnection() {
this.pc.close();
this.pc = new RTCPeerConnection({
sdpSemantics: "unified-plan",
iceServers: [
{
urls: [
"stun:stun.l.google.com:19302",
"turn:13.51.237.138:19303"
],
username: "PixelStreamingUser",
credential: "AnotherTURNintheroad"
},
],
});
but still not connecting . do I need edit signal.js (p.s I made sure that servers work using ue4 signalling)? :
// sent to Unreal Engine as initial signal
ws.send(
JSON.stringify({
type: "config",
peerConnectionOptions: {
// iceServers: [{ urls: ["stun:34.250.222.95:19302"] }],
},
})
);
when I uncomment the line engine connects but crashes instantly and the error is peer connection option is invalid
Here is initial signal sent by official ue4 server:
[2021.12.03-17.19.39:571][353]LogPixelStreamingSS: <- SS: {"type":"offer","sdp":"v=0\r\no=- 7091501754723381106 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 1 2\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 122 102 121 127 120 125 107 108 109 35 36 124 119 123 118 114 115 116 37\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:raMx\r\na=ice-pwd:6wDNxp6qZ1Rb9iM84C3naIJd\r\na=ice-options:trickle\r\na=fingerprint:sha-256 31:64:20:4F:76:3A:EC:5A:79:9B:AA:2F:0A:86:71:17:DF:0D:73:2D:F9:66:54:13:A0:14:14:90:62:82:AC:D2\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 urn:3gpp:video-orientation\r\na=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:5 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\na=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\na=extmap:9 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=recvonly\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=fmtp:98 profile-id=0\r\na=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 VP9/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=fmtp:100 profile-id=2\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:122 VP9/90000\r\na=rtcp-fb:122 goog-remb\r\na=rtcp-fb:122 transport-cc\r\na=rtcp-fb:122 ccm fir\r\na=rtcp-fb:122 nack\r\na=rtcp-fb:122 nack pli\r\na=fmtp:122 profile-id=1\r\na=rtpmap:102 H264/90000\r\na=rtcp-fb:102 goog-remb\r\na=rtcp-fb:102 transport-cc\r\na=rtcp-fb:102 ccm fir\r\na=rtcp-fb:102 nack\r\na=rtcp-fb:102 nack pli\r\na=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f\r\na=rtpmap:121 rtx/90000\r\na=fmtp:121 apt=102\r\na=rtpmap:127 H264/90000\r\na=rtcp-fb:127 goog-remb\r\na=rtcp-fb:127 transport-cc\r\na=rtcp-fb:127 ccm fir\r\na=rtcp-fb:127 nack\r\na=rtcp-fb:127 nack pli\r\na=fmtp:127 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f\r\na=rtpmap:120 rtx/90000\r\na=fmtp:120 apt=127\r\na=rtpmap:125 H264/90000\r\na=rtcp-fb:125 goog-remb\r\na=rtcp-fb:125 transport-cc\r\na=rtcp-fb:125 ccm fir\r\na=rtcp-fb:125 nack\r\na=rtcp-fb:125 nack pli\r\na=fmtp:125 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:107 rtx/90000\r\na=fmtp:107 apt=125\r\na=rtpmap:108 H264/90000\r\na=rtcp-fb:108 goog-remb\r\na=rtcp-fb:108 transport-cc\r\na=rtcp-fb:108 ccm fir\r\na=rtcp-fb:108 nack\r\na=rtcp-fb:108 nack pli\r\na=fmtp:108 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f\r\na=rtpmap:109 rtx/90000\r\na=fmtp:109 apt=108\r\na=rtpmap:35 AV1/90000\r\na=rtcp-fb:35 goog-remb\r\na=rtcp-fb:35 transport-cc\r\na=rtcp-fb:35 ccm fir\r\na=rtcp-fb:35 nack\r\na=rtcp-fb:35 nack pli\r\na=rtpmap:36 rtx/90000\r\na=fmtp:36 apt=35\r\na=rtpmap:124 H264/90000\r\na=rtcp-fb:124 goog-remb\r\na=rtcp-fb:124 transport-cc\r\na=rtcp-fb:124 ccm fir\r\na=rtcp-fb:124 nack\r\na=rtcp-fb:124 nack pli\r\na=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d001f\r\na=rtpmap:119 rtx/90000\r\na=fmtp:119 apt=124\r\na=rtpmap:123 H264/90000\r\na=rtcp-fb:123 goog-remb\r\na=rtcp-fb:123 transport-cc\r\na=rtcp-fb:123 ccm fir\r\na=rtcp-fb:123 nack\r\na=rtcp-fb:123 nack pli\r\na=fmtp:123 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=64001f\r\na=rtpmap:118 rtx/90000\r\na=fmtp:118 apt=123\r\na=rtpmap:114 red/90000\r\na=rtpmap:115 rtx/90000\r\na=fmtp:115 apt=114\r\na=rtpmap:116 ulpfec/90000\r\na=rtpmap:37 flexfec-03/90000\r\na=rtcp-fb:37 goog-remb\r\na=rtcp-fb:37 transport-cc\r\na=fmtp:37 repair-window=10000000\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 63 103 104 9 0 8 110 112 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:raMx\r\na=ice-pwd:6wDNxp6qZ1Rb9iM84C3naIJd\r\na=ice-options:trickle\r\na=fingerprint:sha-256 31:64:20:4F:76:3A:EC:5A:79:9B:AA:2F:0A:86:71:17:DF:0D:73:2D:F9:66:54:13:A0:14:14:90:62:82:AC:D2\r\na=setup:actpass\r\na=mid:1\r\na=extmap:14 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:4 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:9 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:10 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:11 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=recvonly\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1;stereo=1;sprop-maxcapturerate=48000\r\na=rtpmap:63 red/48000/2\r\na=fmtp:63 111/111\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:112 telephone-event/32000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\nm=application 9 UDP/DTLS/SCTP webrtc-datachannel\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:raMx\r\na=ice-pwd:6wDNxp6qZ1Rb9iM84C3naIJd\r\na=ice-options:trickle\r\na=fingerprint:sha-256 31:64:20:4F:76:3A:EC:5A:79:9B:AA:2F:0A:86:71:17:DF:0D:73:2D:F9:66:54:13:A0:14:14:90:62:82:AC:D2\r\na=setup:actpass\r\na=mid:2\r\na=sctp-port:5000\r\na=max-message-size:262144\r\n","playerId":"101"}
Update : turn working by adding:
ws.send(
JSON.stringify({
type: "config",
peerConnectionOptions: {
iceServers: [{ urls: ["stun:stun.l.google.com:19302"
,"turn:13.51.237.138:19303"],
username:"PixelStreamingUser",
credential:"AnotherTURNintheroad" }],
},
})
);
will create a pull request once I automate getting ip for config
Feature added in #7
更新 :通过添加以下内容来工作:
ws.send( JSON.stringify({ type: "config", peerConnectionOptions: { iceServers: [{ urls: ["stun:stun.l.google.com:19302" ,"turn:13.51.237.138:19303"], username:"PixelStreamingUser", credential:"AnotherTURNintheroad" }], }, }) );
一旦我自动获取配置的ip,就会创建一个拉取请求
能否把你的coturn配置放上来给我们参考参考呢?
How to add a turn server to this? most people cannot connect without a turn server !