MediaTrackConstraints: latency property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
TheMediaTrackConstraints dictionary'slatency property is aConstrainDoubledescribing the requested or mandatory constraints placed upon the value of thelatency constrainable property.
If needed, you can determine whether or not this constraint is supported by checkingthe value ofMediaTrackSupportedConstraints.latency as returned by a calltoMediaDevices.getSupportedConstraints(). However, typically this isunnecessary since browsers will ignore any constraints they're unfamiliar with.
BecauseRTP doesn't include this information, tracks associated with aWebRTCRTCPeerConnectionwill never include this property.
In this article
Value
AConstrainDouble describing the acceptable or required value(s) for anaudio track's latency, with values specified in seconds. In audio processing, latency isthe time between the start of processing (when sound occurs in the real world, or isgenerated by a hardware device) and the data being made available to the next step inthe audio input or output process. In most cases, low latency is desirable forperformance and user experience purposes, but when power consumption is a concern, ordelays are otherwise acceptable, higher latency might be acceptable.
If this property's value is a number, the user agent will attempt to obtain media whoselatency tends to be as close as possible to this number given the capabilities of thehardware and the other constraints specified. Otherwise, the value of thisConstrainDouble will guide the user agent in its efforts to provide anexact match to the required latency (ifexact is specified or bothmin andmax are provided and have the same value) or to abest-possible value.
Note:Latency is always prone to some variation due to hardware usage demands, networkconstraints, and so forth, so even in an "exact" match, some variation should beexpected.
Examples
See theConstraint exerciser example.
Specifications
| Specification |
|---|
| Media Capture and Streams> # dom-mediatrackconstraintset-latency> |