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 var actualBuffer = 0; |
| 9 |
| 10 // Create an MediaElementSource node with the given |url| and connect it to weba
udio. |
| 11 // |oncomplete| is given the completion event to check the result. |
| 12 function runTest (url, oncomplete) |
| 13 { |
| 14 if (window.testRunner) { |
| 15 testRunner.dumpAsText(); |
| 16 testRunner.waitUntilDone(); |
| 17 } |
| 18 |
| 19 window.jsTestIsAsync = true; |
| 20 |
| 21 context = new OfflineAudioContext(1, sampleRate * lengthInSeconds, sampleRat
e); |
| 22 audio = document.createElement('audio'); |
| 23 audio.src = url; |
| 24 source = context.createMediaElementSource(audio); |
| 25 source.connect(context.destination); |
| 26 |
| 27 audio.addEventListener("playing", function(e) { |
| 28 context.startRendering(); |
| 29 }); |
| 30 |
| 31 context.oncomplete = function(e) { |
| 32 checkResult(e); |
| 33 finishJSTest(); |
| 34 } |
| 35 |
| 36 audio.play(); |
| 37 } |
OLD | NEW |