Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/WebKit/ManualTests/webaudio/audiooutputtimestamp.html

Issue 2060833002: Implementation of 'AudioContext.getOutputTimestamp' method (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from miu@ Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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>
34
35 <p>When context is running the obtained audio timestamp and performance time stamp values must be always
36 slightly behind of 'AudioContext.currentTime' and 'Performance.now()' cor respondingly.</p>
37
38 <p>Please see <a href="https://webaudio.github.io/web-audio-api/#methods-1"> Web Audio
39 API</a> for more details.</p>
40
41 <div class="manual-test-ui">
42 <div id="audioTime"></div>
43 <div id="performanceTime"></div>
44 <div id="timestampContextTime"></div>
45 <div id="timestampPerformanceTime"></div>
46
47 <button id="startButton" onclick="start()">Start</button>
48 <button id="valuesButton" onclick="refreshValues()">Refresh Values</button >
49 <button onclick="context.suspend()">Suspend</button>
50 <button onclick="context.resume()">Resume</button>
51 </div>
52
53 <script type="text/javascript">
54 var context = new AudioContext();
55
56 refreshValues();
57
58 function start() {
59 document.querySelector('#startButton').disabled = true;
60 let oscillator = context.createOscillator();
61 oscillator.connect(context.destination);
62 oscillator.start();
63 }
64
65 function refreshValues() {
66 document.querySelector("#audioTime").innerHTML = "context.currentTime: " + context.currentTime;
67 document.querySelector("#performanceTime").innerHTML = "performance.now( ): " + performance.now();
68
69 let timestamp = context.getOutputTimestamp();
70 document.querySelector("#timestampContextTime").innerHTML = "timestamp a udio: " + timestamp.contextTime;
71 document.querySelector("#timestampPerformanceTime").innerHTML = "timesta mp performance: " + timestamp.performanceTime;
72 }
73 </script>
74 </body>
75 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698