dom/media/test/test_multiple_mediastreamtracks.html
author Jan-Ivar Bruaroey <jib@mozilla.com>
Tue, 14 Jul 2015 10:12:31 -0400
changeset 287631 79d3b8d912500dfc4705573c8036a0b9c91575f7
parent 283407 b00a687ec1f2a00c943c7a61d74006d9ed651f74
child 347082 54d171fd763aa31c241ceb4bee9b47f98fdb070a
permissions -rw-r--r--
Bug 1175523 - Update most (but not all) tests to use elem.srcObject over .mozSrcObject. r=pehrsons

<!DOCTYPE HTML>
<html>
<head>
  <title>Test the ability of MediaStream with multiple MediaStreamTracks</title>
  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
  <script type="text/javascript" src="manifest.js"></script>
</head>
<body>
<pre id="test">
<script class="testbody" type="text/javascript">
function startTest() {
  navigator.mediaDevices.getUserMedia({audio:true, video:true, fake:true, fakeTracks:true})
  .then(function(stream) {
    var element = document.createElement("video");

    element.onloadedmetadata = function() {
      is(stream.getAudioTracks().length, 4, 'Length of audio tracks should be 4.');
      is(stream.getVideoTracks().length, 3, 'Length of vudio tracks should be 3.');
      SimpleTest.finish();
    };

    mStream = stream;
    element.srcObject = mStream;
    element.play();
  })
  .catch(function(reason) {
    ok(false, "unexpected error = " + reason.message);
    SimpleTest.finish();
  });
}

SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
  {
    "set": [
      ["media.track.enabled", true]
    ]
  }, startTest);

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