audio stream test
authorDominique Hazael-Massieux <dom@w3.org>
Thu, 31 May 2012 11:30:11 +0200
changeset 3 a7a3bd0a1445
parent 2 c616cc15cfb5
child 4 f80cdb9f4b71
audio stream test
submitted/W3C/audio.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/submitted/W3C/audio.html	Thu May 31 11:30:11 2012 +0200
@@ -0,0 +1,33 @@
+<!doctype html>
+<html>
+<head>
+<title>getUserMedia({audio:true}) creates a stream with at least an audio track</title>
+<link rel="author" title="Dominique Hazael-Massieux" href="mailto:[email protected]"/>
+<link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#navigatorusermedia">
+<link rel='stylesheet' href='/resources/testharness.css' media='all'/>
+</head>
+<body>
+<p>When prompted, accept to share your audio stream.</p>
+<h1>Description</h1>
+<p>This test checks that the LocalMediaStream object returned by the success callback in getUserMedia has at least one audio track.</p>
+
+<div id='log'></div>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script src=featuredetection.js></script>
+<script src=prefix.js></script>
+<script>
+var t = async_test("Tests that a MediaStream with at least one audio track is returned");
+if (window.navigator.getUserMedia) { 
+  navigator.getUserMedia({audio:true}, function (stream) {
+  t.step(function () { 
+     assert_true(stream instanceof LocalMediaStream, "getUserMedia success callback comes with a LocalMediaStream object");
+     assert_true(stream.audioTracks.length >= 1, "the media stream has at least one audio track");
+     assert_equals(stream.videoTracks.length, 0, "the media stream has zero video track");
+  });
+  t.done();
+});
+}
+</script>
+</body>
+</html>