安全上下文
此特征只可用于 安全上下文 (HTTPS),在某些或所有 支持浏览器 .

只读 inputSources 特性为 XRSession interface returns an XRInputSourceArray object which lists all controllers and input devices which are expressly associated with the XR device and are currently available. These controllers may include handheld controllers, XR-equipped gloves, optically tracked hands, and gaze-based input methods. Keyboards, gamepads, and mice are not considered WebXR input sources.

注意: Traditional gamepad controllers are supported using the 手柄 API .

句法

inputSources = xrSession.inputSources;
					

XRInputSourceArray object listing all of the currently-connected input controllers which are linked specifically to the XR device currently in use. The returned object is live ; as devices are connected to and removed from the user's system, the list's contents update to reflect the changes.

用法注意事项

You can add a handler for the XRSession event inputsourceschange to be advised when the contents of the session's connected devices list changes. You can then either get the value of inputSources to examine the list, or you can refer to a reference to the list that you've previously saved.

规范

规范 状态 注释
WebXR 设备 API
The definition of 'XRSession.inputSources' in that specification.
工作草案 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
inputSources Chrome 79 Edge 79 Firefox 不支持 No IE 不支持 No Opera 不支持 No Safari 不支持 No WebView Android 不支持 No Chrome Android 79 Firefox Android 不支持 No Opera Android 不支持 No Safari iOS 不支持 No Samsung Internet Android 11.2

图例

完整支持

完整支持

不支持

不支持

另请参阅

元数据

  • 最后修改: