AudioContextOptions.latencyHint - Web APIs 编辑
The AudioContextOptions
dictionary (used when instantiating an AudioContext
) may contain a property named latencyHint
, which indicates the preferred maximum latency in seconds for the audio context. The value is specified either as a member of the string enum AudioContextLatencyCategory
or a double-precision value.
Syntax
audioContextOptions.latencyHint = "interactive"; audioContextOptions.latencyHint = 0.2; var latencyHint = audioContextOptions.latencyHint;
Value
The preferred maximum latency for the AudioContext
. There are two ways this value can be specified.
The best way to specify the preferred latency is to use a value form the string enum AudioContextLatencyCategory
. In fact, the default value of latencyHint
is "interactive"
(meaning the browser should try to use the lowest possible and reliable latency it can).
The value can also be specified as a double-precision floating-point value, specifying the preferred maximum latency in seconds. This provides more precise control over the balance between audio latency and device energy usage.
To determine the actual latency of the context after creating it, check the value of the context's baseLatency
property.
Specifications
Specification | Status | Comment |
---|---|---|
Web Audio API The definition of 'AudioContextOptions.latencyHint' in that specification. | Working Draft | Initial definition. |
Browser compatibility
BCD tables only load in the browser
See also
AudioContext
: The interface describing an audio contextAudioContext()
: The audio context constructor, which accepts aAudioContextOptions
object as an input.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论