Movatterモバイル変換


[0]ホーム

URL:


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

MediaTrackSettings: aspectRatio property

Limited availability

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

TheMediaTrackSettings dictionary'saspectRatio property is a double-precision floating-point number indicating theaspect ratio of theMediaStreamTrack as currently configured.This lets you determine what value was selected to comply with your specified constraints for this property's value as described in theMediaTrackConstraints.aspectRatio property you provided when calling eithergetUserMedia() orMediaStreamTrack.applyConstraints().

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

A double-precision floating-point number indicating the current configuration of thetrack's aspect ratio. The aspect ratio is computed by taking the track's width, dividingby its height, and rounding the result to ten decimal places. For example, the standard16:9 high-definition aspect ratio can be computed as 1920/1080, or 1.7777777778.

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