OLD | NEW |
(Empty) | |
| 1 // Test MediaStreamAudioSourceNode's with different URLs. |
| 2 // |
| 3 var context = 0; |
| 4 var lengthInSeconds = 1; |
| 5 var sampleRate = 44100; |
| 6 var source = 0; |
| 7 var audio = 0; |
| 8 |
| 9 // Create an MediaElementSource node with the given |url| and connect it to weba
udio. |
| 10 // |oncomplete| is given the completion event to check the result. |
| 11 function runTest (url, oncomplete, tester) |
| 12 { |
| 13 if (window.testRunner) { |
| 14 testRunner.dumpAsText(); |
| 15 testRunner.waitUntilDone(); |
| 16 } |
| 17 |
| 18 window.jsTestIsAsync = true; |
| 19 |
| 20 context = new OfflineAudioContext(1, sampleRate * lengthInSeconds, sampleRat
e); |
| 21 |
| 22 audio = document.createElement('audio'); |
| 23 |
| 24 if (tester) { |
| 25 tester(); |
| 26 } else { |
| 27 audio.src = url; |
| 28 } |
| 29 |
| 30 source = context.createMediaElementSource(audio); |
| 31 source.connect(context.destination); |
| 32 |
| 33 audio.addEventListener("playing", function(e) { |
| 34 context.startRendering(); |
| 35 }); |
| 36 |
| 37 context.oncomplete = function(e) { |
| 38 checkResult(e); |
| 39 finishJSTest(); |
| 40 } |
| 41 |
| 42 audio.play(); |
| 43 } |
OLD | NEW |