tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_peerConnection_webAudio.html (1287B)


      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: "1081819",
     11  title: "WebAudio on both input and output side of peerconnection"
     12 });
     13 
     14 // This tests WebAudio (a 700Hz OscillatorNode) as input to a PeerConnection.
     15 // It also tests that a PeerConnection works as input to WebAudio as the remote
     16 // stream is connected to an AnalyserNode and compared to the source node.
     17 
     18 runNetworkTest(function() {
     19  const test = new PeerConnectionTest();
     20  test.audioContext = new AudioContext();
     21  test.setMediaConstraints([{audio: true}], []);
     22  test.chain.replace("PC_LOCAL_GUM", [
     23    function PC_LOCAL_WEBAUDIO_SOURCE(test) {
     24      const oscillator = test.audioContext.createOscillator();
     25      oscillator.type = 'sine';
     26      oscillator.frequency.value = 700;
     27      oscillator.start();
     28      const dest = test.audioContext.createMediaStreamDestination();
     29      oscillator.connect(dest);
     30      test.pcLocal.attachLocalStream(dest.stream);
     31    }
     32  ]);
     33  test.chain.append([
     34    function CHECK_AUDIO_FLOW(test) {
     35      return test.pcRemote.checkReceivingToneFrom(test.audioContext, test.pcLocal);
     36    }
     37  ]);
     38  return test.run();
     39 });
     40 </script>
     41 </pre>
     42 </body>
     43 </html>