test_peerConnection_basicAudioNATRelayTCP.html (1768B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <script type="application/javascript" src="pc.js"></script> 5 </head> 6 <body> 7 <pre id="test"> 8 <script type="application/javascript"> 9 createHTML({ 10 bug: "1231975", 11 title: "Basic audio-only peer connection with port dependent NAT that blocks UDP" 12 }); 13 14 // This test uses the NAT simulator, which doesn't work in https, so we turn 15 // on getUserMedia in http, which requires a reload. 16 if (!("mediaDevices" in navigator)) { 17 SpecialPowers.pushPrefEnv({set: [['media.devices.insecure.enabled', true]]}, 18 () => location.reload()); 19 } else { 20 runNetworkTest(async (options = {}) => { 21 await pushPrefs( 22 ['media.peerconnection.ice.obfuscate_host_addresses', false], 23 ['media.peerconnection.nat_simulator.filtering_type', 'PORT_DEPENDENT'], 24 ['media.peerconnection.nat_simulator.mapping_type', 'PORT_DEPENDENT'], 25 ['media.peerconnection.nat_simulator.block_udp', true], 26 ['media.peerconnection.nat_simulator.block_tcp', false], 27 ['media.peerconnection.nat_simulator.block_tls', true], 28 ['media.peerconnection.ice.loopback', true], 29 // The above sets up 5+ ICE servers which triggers a warning 30 ['media.peerconnection.treat_warnings_as_errors', false], 31 ['media.getusermedia.insecure.enabled', true]); 32 options.expectedLocalCandidateType = "relay-tcp"; 33 options.expectedRemoteCandidateType = "relay-tcp"; 34 // No reason to wait for gathering to complete like the other NAT tests, 35 // since relayed-tcp is the only thing that can work. 36 const test = new PeerConnectionTest(options); 37 test.setMediaConstraints([{audio: true}], [{audio: true}]); 38 await test.run(); 39 }, { useIceServer: true }); 40 } 41 </script> 42 </pre> 43 </body> 44 </html>