Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. MediaTrackConstraints
  4. aspectRatio

MediaTrackConstraints: aspectRatio property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

TheMediaTrackConstraints dictionary'saspectRatio property is aConstrainDouble describing the requested or mandatory constraints placed upon the value of theaspectRatio constrainable property.

If needed, you can determine whether or not this constraint is supported by checkingthe value ofMediaTrackSupportedConstraints.aspectRatio as returned by acall toMediaDevices.getSupportedConstraints(). However, typically thisis unnecessary since browsers will ignore any constraints they're unfamiliar with.

Value

AConstrainDouble describing the acceptable or required value(s) for avideo track'saspect ratio. The value is the width divided by the height and is roundedto ten decimal places. For example, the standard high-definition video aspect ratio of16:9 can be computed as 1920/1080, or 1.7777777778.

If this value is a number, the user agent will attempt to obtain media whose aspectratio is as close as possible to this number given the capabilities of the hardware andthe other constraints specified. Otherwise, the value of thisConstrainDouble will guide the user agent in its efforts to provide anexact match to the required aspect ratio (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-aspectratio

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp