我尝试用React-Native上的WebRTC API连接2台设备。所有设备都连接在相同的本地网络上,因此我不需要使用ICE服务器。
从网络到应用程序,报价来源工作和设备之间的连接为completed
。
但是,使用相同的代码,在应用程序上以react-native-webrtc
发出的报价更大,并且在发送sdp时连接无效。
在浏览器上创建的特价商品和工作:
{"type":"offer","sdp":"v=0\r\no=- 2622406983783727652 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE data\r\na=msid-semantic: WMS\r\nm=application 34771 DTLS/SCTP 5000\r\nc=IN IP4 192.168.10.21\r\na=candidate:3031968640 1 udp 2113937151 192.168.10.21 34771 typ host generation 0 network-cost 999\r\na=ice-ufrag:JWgO\r\na=ice-pwd:bAjL9i5KAlbQLpJH1mgfb2LR\r\na=ice-options:trickle\r\na=fingerprint:sha-256 1C:DA:20:FC:DB:4E:5A:7C:2F:63:29:FA:CF:61:22:5F:5B:DA:61:B0:78:1A:C4:FB:48:3B:A2:CB:56:8F:99:8F\r\na=setup:actpass\r\na=mid:data\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n"}
并且报价以react-native-webrtc
为源,不起作用:
{"sdp":"v=0\r\no=- 7119981603413777188 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video data\r\na=msid-semantic: WMS 057151a9-76f8-4329-80da-90e201eb5113\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 103 9 102 0 8 105 13 110 113 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:kn1n\r\na=ice-pwd:EQG/ZMgPl98d8HxoXrQAt2tb\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 76:EC:F5:C1:83:B4:9C:5A:8F:A9:27:BE:69:73:D8:79:F0:52:74:3B:13:81:A1:4B:34:5D:A6:51:8E:33:14:94\r\na=setup:actpass\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\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\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:102 ILBC/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127 125 104\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:kn1n\r\na=ice-pwd:EQG/ZMgPl98d8HxoXrQAt2tb\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 76:EC:F5:C1:83:B4:9C:5A:8F:A9:27:BE:69:73:D8:79:F0:52:74:3B:13:81:A1:4B:34:5D:A6:51:8E:33:14:94\r\na=setup:actpass\r\na=mid:video\r\na=extmap:2 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:4 urn:3gpp:video-orientation\r\na=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\na=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\na=sendrecv\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=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 H264/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 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:127 red/90000\r\na=rtpmap:125 rtx/90000\r\na=fmtp:125 apt=127\r\na=rtpmap:104 ulpfec/90000\r\na=ssrc-group:FID 3518967946 2791859091\r\na=ssrc:3518967946 cname:aZrsmfRxy+CXTcjY\r\na=ssrc:3518967946 msid:057151a9-76f8-4329-80da-90e201eb5113 e8d845d0-c717-4c01-a774-f1a83869958c\r\na=ssrc:3518967946 mslabel:057151a9-76f8-4329-80da-90e201eb5113\r\na=ssrc:3518967946 label:e8d845d0-c717-4c01-a774-f1a83869958c\r\na=ssrc:2791859091 cname:aZrsmfRxy+CXTcjY\r\na=ssrc:2791859091 msid:057151a9-76f8-4329-80da-90e201eb5113 e8d845d0-c717-4c01-a774-f1a83869958c\r\na=ssrc:2791859091 mslabel:057151a9-76f8-4329-80da-90e201eb5113\r\na=ssrc:2791859091 label:e8d845d0-c717-4c01-a774-f1a83869958c\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:kn1n\r\na=ice-pwd:EQG/ZMgPl98d8HxoXrQAt2tb\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 76:EC:F5:C1:83:B4:9C:5A:8F:A9:27:BE:69:73:D8:79:F0:52:74:3B:13:81:A1:4B:34:5D:A6:51:8E:33:14:94\r\na=setup:actpass\r\na=mid:data\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n","type":"offer"}
在最新报价中,我看到很多URL,也许RTCPeerConnection上的配置参数不起作用?
const configuration = { iceServers: [{ urls: [] }] };
const pc = new RTCPeerConnection(configuration);
有人可以帮助我吗?