summaryrefslogtreecommitdiffstats
path: root/dom/media/webrtc/tests/mochitests/test_getUserMedia_nonDefaultRate.html
blob: 8a6ac8c62bff60984bbed51a07325b027188c9ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
  createHTML({
    title: "getUserMedia feed to a graph with non default rate",
    bug: "1387454",
  });

  /**
   * Run a test to verify that when we use the streem from a gUM to an AudioContext
   * with non default rate the connection fails. (gUM is always on default rate).
   */
  runTest(async () => {
    // Since we do not examine the stream we do not need loopback.
    DISABLE_LOOPBACK_TONE = true;
    const stream = await getUserMedia({audio: true});
    const nonDefaultRate = 32000;
    const ac = new AudioContext({sampleRate: nonDefaultRate});
    mustThrowWith(
      "Connect stream with graph of different sample rate",
      "NotSupportedError", () => {
        ac.createMediaStreamSource(stream);
      }
    );
    for (let t of stream.getTracks()) {
      t.stop();
    }
  });
</script>
</pre>
</body>
</html>