Refactoring: Pull all fullscreen code out of Document and into its own helper class
[WebKit-https.git] / LayoutTests / webaudio / audiobuffersource.html
1 <!DOCTYPE html>
2
3 <!--
4 See if we can load an AudioBuffer, create an AudioBufferSourceNode, attach the buffer to it, then play it.
5 -->
6
7 <html>
8 <head>
9 <script type="text/javascript" src="resources/audio-testing.js"></script>
10 <script type="text/javascript" src="resources/buffer-loader.js"></script>
11
12 <script>
13
14 window.onload = init;
15
16 var sampleRate = 44100.0;
17 var lengthInSeconds = 2;
18
19 var context = 0;
20 var bufferLoader = 0;
21
22 function init() {
23     if (!window.testRunner)
24         return;
25         
26     // Create offline audio context.
27     context = new webkitOfflineAudioContext(2, sampleRate * lengthInSeconds, sampleRate);
28     
29     bufferLoader = new BufferLoader(
30         context,
31         [
32             "resources/hyper-reality/br-jam-loop.wav",
33         ],
34         finishedLoading
35     );
36     
37     bufferLoader.load();
38     testRunner.waitUntilDone();
39 }
40
41 function finishedLoading(bufferList) {
42     var bufferSource = context.createBufferSource();
43     bufferSource.buffer = bufferList[0];
44     
45     bufferSource.connect(context.destination);
46     bufferSource.start(0);
47     
48     context.oncomplete = finishAudioTest;
49     context.startRendering();    
50 }
51
52 </script>
53 </head>
54 <body>
55 </body>
56 </html>