OLD | NEW |
1 <!doctype html> | 1 <!doctype html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>A disabled audio track is rendered as silence</title> | 4 <title>A disabled audio track is rendered as silence</title> |
5 <link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/> | 5 <link rel="author" title="Dominique Hazael-Massieux" href="mailto:dom@w3.org"/> |
6 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#in
troduction"> | 6 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#in
troduction"> |
7 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#me
diastreams-as-media-elements"> | 7 <link rel="help" href="http://dev.w3.org/2011/webrtc/editor/getusermedia.html#me
diastreams-as-media-elements"> |
8 <link rel='stylesheet' href='../../../../../resources/testharness.css' media='al
l'/> | |
9 </head> | 8 </head> |
10 <body> | 9 <body> |
11 <p class="instructions" style="display:none">When prompted, accept to share your
audio stream.</p> | 10 <p class="instructions" style="display:none">When prompted, accept to share your
audio stream.</p> |
12 <h1 class="instructions" style="display:none">Description</h1> | 11 <h1 class="instructions" style="display:none">Description</h1> |
13 <p class="instructions" style="display:none">This test checks that a disabled au
dio track in a | 12 <p class="instructions" style="display:none">This test checks that a disabled au
dio track in a |
14 MediaStream is rendered as silence. It relies on the | 13 MediaStream is rendered as silence. It relies on the |
15 <a href="https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html"> | 14 <a href="https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html"> |
16 Web Audio API</a>.</p> | 15 Web Audio API</a>.</p> |
17 | 16 |
18 <div id='log'></div> | 17 <div id='log'></div> |
19 <script src=../../../../../resources/testharness.js></script> | 18 <script src=../../../resources/testharness.js></script> |
20 <script src=../../../../../resources/testharnessreport.js></script> | 19 <script src=../../../resources/testharnessreport.js></script> |
21 <script src="../../../../../resources/vendor-prefix.js" data-prefixed-objects='[
{"ancestors":["navigator"], "name":"getUserMedia"}, {"ancestors":["window"], "na
me":"AudioContext"}]'></script> | 20 <script src="../../../resources/vendor-prefix.js" data-prefixed-objects='[{"ance
stors":["navigator"], "name":"getUserMedia"}, {"ancestors":["window"], "name":"A
udioContext"}]'></script> |
22 <script> | 21 <script> |
23 var t = async_test("Tests that a disabled audio track in a MediaStream is render
ed as silence", {timeout: 200000}); | 22 var t = async_test("Tests that a disabled audio track in a MediaStream is render
ed as silence", {timeout: 200000}); |
24 var aud = document.getElementById("aud"); | 23 var aud = document.getElementById("aud"); |
25 t.step(function() { | 24 t.step(function() { |
26 navigator.getUserMedia({audio: true}, t.step_func(function (stream) { | 25 navigator.getUserMedia({audio: true}, t.step_func(function (stream) { |
27 var ctx = new AudioContext(); | 26 var ctx = new AudioContext(); |
28 var streamSource = ctx.createMediaStreamSource(stream); | 27 var streamSource = ctx.createMediaStreamSource(stream); |
29 var silenceDetector = ctx.createScriptProcessor(1024); | 28 var silenceDetector = ctx.createScriptProcessor(1024); |
30 var count = 10; | 29 var count = 10; |
31 silenceDetector.onaudioprocess = t.step_func(function (e) { | 30 silenceDetector.onaudioprocess = t.step_func(function (e) { |
(...skipping 15 matching lines...) Expand all Loading... |
47 }); | 46 }); |
48 stream.getAudioTracks()[0].enabled = false; | 47 stream.getAudioTracks()[0].enabled = false; |
49 | 48 |
50 streamSource.connect(silenceDetector); | 49 streamSource.connect(silenceDetector); |
51 silenceDetector.connect(ctx.destination); | 50 silenceDetector.connect(ctx.destination); |
52 }), function(error) {}); | 51 }), function(error) {}); |
53 }); | 52 }); |
54 </script> | 53 </script> |
55 </body> | 54 </body> |
56 </html> | 55 </html> |
OLD | NEW |