summaryrefslogtreecommitdiffstats
path: root/dom/media/tests/mochitest/test_getUserMedia_gumWithinGum.html
blob: f8cecd9d9bdb9af18e926c36d9964c90e228bf67 (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
38
39
<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
  createHTML({title: "getUserMedia within getUserMedia", bug: "822109" });
  /**
   * Run a test that we can complete a playback cycle for a video,
   * then upon completion, do a playback cycle with audio, such that
   * the audio gum call happens within the video gum call.
   */
  runTest(function () {
    return getUserMedia({video: true})
      .then(videoStream => {
        var testVideo = createMediaElement('video', 'testVideo');
        var videoPlayback = new LocalMediaStreamPlayback(testVideo,
                                                         videoStream);

        return videoPlayback.playMedia(false)
          .then(() => getUserMedia({audio: true}))
          .then(audioStream => {
            var testAudio = createMediaElement('audio', 'testAudio');
            var audioPlayback = new LocalMediaStreamPlayback(testAudio,
                                                             audioStream);

            return audioPlayback.playMedia(false)
              .then(() => audioStream.stop());
          })
          .then(() => videoStream.stop());
      });
  });

</script>
</pre>
</body>
</html>