OLD | NEW |
---|---|
(Empty) | |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <title>Test AudioContext.getOutputTimestamp() method</title> | |
5 <style type="text/css"> | |
6 body { | |
7 margin: 2em; | |
8 } | |
9 .manual-test-ui { | |
10 font-family: Arial; | |
11 padding: 1em; | |
12 border: 1px solid #999; | |
13 } | |
14 .manual-test-ui button { | |
15 padding: 1em; | |
16 font-size: 1em; | |
17 } | |
18 .manual-test-ui div { | |
19 padding: 10px; | |
20 font-size: 1.5em; | |
21 } | |
22 </style> | |
23 </head> | |
24 | |
25 <body> | |
26 <h1>Test AudioContext.getOutputTimestamp() method</h1> | |
27 | |
28 <p>Tests the values returned from AudioContext.getOutputTimestamp()</p> | |
29 | |
30 <p>Press "Start" to run the test. You should hear a sine tone.</p> | |
31 | |
32 <p>Press "Refresh" to fetch the fresh output audio timestamp values | |
33 and compare them to 'AudioContext.currentTime' and 'Performance.now()'. </ p> | |
Raymond Toy
2016/11/04 17:51:39
Please give some indication of what the expected r
Mikhail
2016/11/28 15:15:59
Done.
| |
34 | |
35 <p><b>Note: </b> The "AudioTimestamp" Runtime Enabled Feature must be enable d: | |
36 i.e. use '--enable-blink-features=AudioTimestamp' in command-line switches for | |
37 chrome/content_shell.</p> | |
38 | |
39 <div class="manual-test-ui"> | |
40 <div id="audioTime"></div> | |
41 <div id="performanceTime"></div> | |
42 <div id="timestampContextTime"></div> | |
43 <div id="timestampPerformanceTime"></div> | |
44 | |
45 <button id="startButton" onclick="start()">Start</button> | |
46 <button id="valuesButton" onclick="refreshValues()">Refresh Values</button > | |
47 <button onclick="context.suspend()">Suspend</button> | |
48 <button onclick="context.resume()">Resume</button> | |
49 </div> | |
50 | |
51 <script type="text/javascript"> | |
52 var context = new AudioContext(); | |
53 | |
54 refreshValues(); | |
55 | |
56 function start() { | |
57 document.querySelector('#startButton').disabled = true; | |
58 let oscillator = context.createOscillator(); | |
59 oscillator.connect(context.destination); | |
60 oscillator.start(); | |
61 } | |
62 | |
63 function refreshValues() { | |
64 document.querySelector("#audioTime").innerHTML = "context.currentTime: " + context.currentTime; | |
65 document.querySelector("#performanceTime").innerHTML = "performance.now( ): " + performance.now(); | |
66 | |
67 let timestamp = context.getOutputTimestamp(); | |
68 document.querySelector("#timestampContextTime").innerHTML = "timestamp a udio: " + timestamp.contextTime; | |
69 document.querySelector("#timestampPerformanceTime").innerHTML = "timesta mp performance: " + timestamp.performanceTime; | |
70 } | |
71 </script> | |
72 </body> | |
73 </html> | |
OLD | NEW |