过时
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.
getVRDisplays()
方法在
Navigator
interface returns a promise that resolves to an array of
VRDisplay
objects representing any available VR displays connected to the computer.
navigator.getVRDisplays().then(function(displays) {
// Do something with the available VR displays
});
None.
A promise that resolves to an array of
VRDisplay
对象。
if(navigator.getVRDisplays) {
console.log('WebVR 1.1 supported');
// Then get the displays attached to the computer
navigator.getVRDisplays().then(function(displays) {
// If a display is available, use it to present the scene
if(displays.length > 0) {
vrDisplay = displays[0];
// Now we have our VRDisplay object and can do what we want with it
}
});
}
注意 : You can see this complete code at raw-webgl-example .
| 规范 | 状态 | 注释 |
|---|---|---|
|
WebVR 1.1
The definition of 'getVRDisplays()' in that specification. |
草案 | 初始定义 |
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
getVRDisplays
弃用
|
Chrome
No
|
Edge 15 — 79 |
Firefox
55
|
IE No | Opera No | Safari No | WebView Android ? — 80 |
Chrome Android
? — 80
|
Firefox Android 55 | Opera Android No | Safari iOS No | Samsung Internet Android No |
完整支持
不支持
实验。期望将来行为有所改变。
弃用。不要用于新网站。
见实现注意事项。