这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
VRDisplayCapabilities
接口在
WebVR API
describes the capabilities of a
VRDisplay
— its features can be used to perform VR device capability tests, for example can it return position information.
This interface is accessible through the
VRDisplay.capabilities
特性。
VRDisplayCapabilities.canPresent
只读
布尔
stating whether the VR display is capable of presenting content (e.g. through an HMD).
VRDisplayCapabilities.hasExternalDisplay
只读
布尔
stating whether the VR display is separate from the device's primary display.
VRDisplayCapabilities.hasOrientation
只读
布尔
stating whether the VR display can track and return orientation information.
VRDisplayCapabilities.hasPosition
只读
布尔
stating whether the VR display can track and return position information.
VRDisplayCapabilities.maxLayers
只读
VRLayer
s that the VR display can present at once (e.g. the maximum length of the array that
VRDisplay.requestPresent()
can accept.)
function reportDisplays() {
navigator.getVRDisplays().then(function(displays) {
for(var i = 0; i < displays.length; i++) {
var cap = displays[i].capabilities;
// cap is a VRDisplayCapabilities object
var listItem = document.createElement('li');
listItem.innerHTML = '<strong>Display ' + (i+1) + '</strong>'
+ '<br>VR Display ID: ' + displays[i].displayId
+ '<br>VR Display Name: ' + displays[i].displayName
+ '<br>Display can present content: ' + cap.canPresent
+ '<br>Display is separate from the computer\'s main display: ' + cap.hasExternalDisplay
+ '<br>Display can return position info: ' + cap.hasPosition
+ '<br>Display can return orientation info: ' + cap.hasOrientation
+ '<br>Display max layers: ' + cap.maxLayers;
list.appendChild(listItem);
}
});
}
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebVR 1.1
The definition of 'VRDisplayCapabilities' in that specification. |
草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
VRDisplayCapabilities
弃用
|
Chrome No | Edge ≤18 — 79 |
Firefox
55
|
IE No | Opera ? | Safari ? | WebView Android No |
Chrome Android
56 — 80
Disabled
|
Firefox Android 55 | Opera Android ? | Safari iOS ? |
Samsung Internet Android
6.0
|
canPresent
弃用
|
Chrome No | Edge 15 — 79 |
Firefox
55
|
IE No | Opera ? | Safari ? | WebView Android No |
Chrome Android
56 — 80
Disabled
|
Firefox Android 55 | Opera Android ? | Safari iOS ? |
Samsung Internet Android
6.0
|
hasExternalDisplay
弃用
|
Chrome No | Edge 15 — 79 |
Firefox
55
|
IE No | Opera ? | Safari ? | WebView Android No |
Chrome Android
56 — 80
Disabled
|
Firefox Android 55 | Opera Android ? | Safari iOS ? |
Samsung Internet Android
6.0
|
hasOrientation
弃用
|
Chrome No | Edge 15 — 79 |
Firefox
55
|
IE No | Opera ? | Safari ? | WebView Android No |
Chrome Android
56 — 80
Disabled
|
Firefox Android 55 | Opera Android ? | Safari iOS ? |
Samsung Internet Android
6.0
|
hasPosition
弃用
|
Chrome No | Edge 15 — 79 |
Firefox
55
|
IE No | Opera ? | Safari ? | WebView Android No |
Chrome Android
56 — 80
Disabled
|
Firefox Android 55 | Opera Android ? | Safari iOS ? |
Samsung Internet Android
6.0
|
maxLayers
弃用
|
Chrome No | Edge 15 — 79 |
Firefox
55
|
IE No | Opera ? | Safari ? | WebView Android No |
Chrome Android
56 — 80
Disabled
|
Firefox Android 55 | Opera Android ? | Safari iOS ? |
Samsung Internet Android
6.0
|
完整支持
不支持
兼容性未知
实验。期望将来行为有所改变。
弃用。不要用于新网站。
见实现注意事项。
用户必须明确启用此特征。