大网数据广告活动
Web 标准与前端开发

MediaTrackConstraints: logicalSurface property

· 52CE 我爱测

The MediaTrackConstraints dictionary's **`logicalSurface`** property is a `ConstrainDOMString` describing the requested or mandatory constraints placed upon the value of the `logicalSurface` constrainable property.

Media Capture and Streams

The MediaTrackConstraints dictionary's logicalSurface property is a ConstrainDOMString describing the requested or mandatory constraints placed upon the value of the logicalSurface constrainable property.

This is used to specify whether or not MediaDevices.getDisplayMedia should allow the user to choose display surfaces which are not necessarily fully visible on the screen, such as occluded windows or the complete content of windows which are large enough to require scrolling to see their entire contents.

If needed, you can determine whether or not this constraint is supported by checking the value of logicalSurface as returned by a call to MediaDevices.getSupportedConstraints(). However, typically this is unnecessary since browsers will ignore any constraints they're unfamiliar with.

Value

A ConstrainBoolean which is true if logical surfaces should be permitted among the selections available to the user.

See how constraints are defined.

Usage notes

You can check the setting selected by the user agent after the display media has been created by MediaDevices.getDisplayMedia by calling MediaStreamTrack.getSettings on the display media's video MediaStreamTrack, then checking the value of the logicalSurface property.

For example, if your app needs to know if the selected display surface is a logical one:

let isLogicalSurface = displayStream
  .getVideoTracks()[0]
  .getSettings().logicalSurface;

Following this code, isLogicalSurface is true if the display surface contained in the stream is a logical surface; that is, one which may not be entirely onscreen, or may even be entirely offscreen.

Specifications

Browser compatibility

See also

来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。

资料来源与适用范围

资料来源
MDN Web Docs / Mozilla 贡献者
适用范围
请按文中版本与环境说明核对
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 2.5

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。