MediaTrackConstraints: sampleRate property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
TheMediaTrackConstraints dictionary'ssampleRate property is aConstrainULongdescribing the requested or mandatory constraints placed upon the value of thesampleRate constrainable property.
If needed, you can determine whether or not this constraint is supported by checkingthe value ofMediaTrackSupportedConstraints.sampleRate as returned by acall toMediaDevices.getSupportedConstraints(). However, typically thisis unnecessary since browsers will ignore any constraints they're unfamiliar with.
In this article
Value
If this value is a number, the user agent will attempt to obtain media whose samplerate is as close as possible to this number given the capabilities of the hardware andthe other constraints specified. Otherwise, the value of thisConstrainULong will guide the user agent in its efforts to provide anexact match to the required sample rate (ifexact is specified or bothmin andmax are provided and have the same value) or to abest-possible value.
Examples
See theConstraint exerciser example.
Specifications
| Specification |
|---|
| Media Capture and Streams> # dom-mediatrackconstraintset-samplerate> |