dom/media/tests/mochitest/test_getUserMedia_stopVideoAudioStreamWithFollowupVideoAudio.html
author Martin Thomson <martin.thomson@gmail.com>
Sat, 21 Feb 2015 10:15:05 +1300
changeset 249897 02405fe4e525fcf652c4e68ad4819ed5521fd4ab
parent 249893 60538ae8bc51d756bb69711b4f05c91d129fe54b
child 252193 a75426ed6ab016ed033a2ecc8e7fdf59125446a1
permissions -rw-r--r--
Bug 1119593 - Aggressively removing boilerplate on tests, r=drno, a=testonly Conflicts: dom/media/tests/mochitest/test_getUserMedia_exceptions.html Conflicts: dom/media/tests/mochitest/test_peerConnection_bug825703.html

<!DOCTYPE HTML>
<html>
<head>
  <script type="application/javascript" src="mediaStreamPlayback.js"></script>
</head>
<body>
<pre id="test">
<script type="application/javascript">
  createHTML({
    title: "getUserMedia Stop Video+Audio Stream With Followup Video+Audio",
    bug: "822109"
  });
  /**
   * Run a test to verify that I can complete an video+audio gum playback in a
   * media element, stop the stream, and then complete another video+audio gum
   * playback in a media element.
   */
  runTest(function () {
    getUserMedia({video: true, audio: true})
      .then(stream => {
        var testVideo = createMediaElement('video', 'testVideo');
        var streamPlayback = new LocalMediaStreamPlayback(testVideo, stream);

        return streamPlayback.playMediaWithStreamStop(false)
          .then(() => getUserMedia({video: true, audio: true}))
          .then(secondStream => {
            streamPlayback.mediaStream = secondStream;

            return streamPlayback.playMedia(false)
              .then(() => secondStream.stop());
          });
      })
      .then(() => SimpleTest.finish(), generateErrorCallback());
  });

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