blob: 219fc42429200f578ed2e348efd2c29bf045c995 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
---
title: AudioContext.baseLatency
slug: Web/API/AudioContext/baseLatency
translation_of: Web/API/AudioContext/baseLatency
---
<p>{{SeeCompatTable}}{{APIRef("Web Audio API")}}</p>
<p class="summary">The <strong><code>baseLatency</code></strong> read-only property of the {{domxref("AudioContext")}} interface returns a double that represents the number of seconds of processing latency incurred by the <code>AudioContext</code> passing the audio from the {{domxref("AudioDestinationNode")}} to the audio subsystem.</p>
<p>You can request a certain latency during {{domxref("AudioContext.AudioContext()", "construction time", "", "true")}} with the <code>latencyHint</code> option but the browser may ignore the option.</p>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox">var <em>baseLatency</em> = <em>audioCtx</em>.baseLatency;</pre>
<h3 id="Value">Value</h3>
<p>A double representing the base latency in seconds.</p>
<h2 id="Example">Example</h2>
<pre class="brush: js">//default latency ("interactive")
const audioCtx1 = new AudioContext();
console.log(audioCtx1.baseLatency);//0.01
//higher latency ("playback")
const audioCtx2 = new AudioContext({ latencyHint: 'playback' });
console.log(audioCtx2.baseLatency);//0.02
</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td>{{SpecName('Web Audio API','#dom-audiocontext-baselatency','baseLatency')}}</td>
<td>{{Spec2('Web Audio API')}}</td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="Browser_Compatibility">Browser Compatibility</h2>
<div>
<p>{{Compat("api.AudioContext.baseLatency")}}</p>
</div>
|