MediaTrackConstraints: sampleSize property
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
TheMediaTrackConstraints dictionary'ssampleSize property is aConstrainULongdescribing the requested or mandatory constraints placed upon the value of thesampleSize constrainable property.
If needed, you can determine whether or not this constraint is supported by checkingthe value ofMediaTrackSupportedConstraints.sampleSize 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 samplesize (in bits per linear sample) is as close as possible to this number given thecapabilities of the hardware and the other constraints specified. Otherwise, the valueof thisConstrainULong will guide the user agent in its efforts to providean exact match to the required sample size (ifexact is specified or bothmin andmax are provided and have the same value) or to abest-possible value.
Note:Since this property can only represent linear sample sizes, this constraint can onlybe met by devices that can produce audio with linear samples.
Examples
See theConstraint exerciser example.
Specifications
| Specification |
|---|
| Media Capture and Streams> # dom-mediatrackconstraintset-samplesize> |