过时
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.
这是
实验性技术
检查
浏览器兼容性表格
要小心谨慎在生产中使用这之前。
HMDVRDevice
接口在
WebVR API
represents a head mounted display, providing access to information about each eye, and allowing us to modify the current field of view.
HMDVRDevice.getEyeParameters()
VREyeParameters
对象。
HMDVRDevice.setFieldOfView()
Sets the field of view for both eyes.
This interface doesn't define any properties of its own, but it does inherit the properties of its parent interface,
VRDevice
.
VRDevice.hardwareUnitId
只读
VRDevice
is a part of. All devices that are part of the same physical piece of hardware will have the same
hardwareUnitId
.
VRDevice.deviceId
只读
VRDevice
. The ID shouldn’t change across browser restarts, allowing configuration data to be saved based on it.
VRDevice.deviceName
只读
VRDevice
.
The following example, taken from the WebVR spec, finds the first available
HMDVRDevice
and its associated
PositionSensorVRDevice
, if it has one.
navigator.getVRDevices().then(function(devices) {
for (var i = 0; i < devices.length; ++i) {
if (devices[i] instanceof HMDVRDevice) {
gHMD = devices[i];
break;
}
}
if (gHMD) {
for (var i = 0; i < devices.length; ++i) {
if (devices[i] instanceof PositionSensorVRDevice && devices[i].hardwareUnitId === gHMD.hardwareUnitId) {
gPositionSensor = devices[i];
break;
}
}
}
});
| 桌面 | 移动 | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
HMDVRDevice
弃用
非标
|
Chrome No | Edge No |
Firefox
39
Disabled
|
IE No | Opera No | Safari No | WebView Android No |
Chrome Android
62
|
Firefox Android
44
|
Opera Android No | Safari iOS No | Samsung Internet Android 8.0 |
getEyeParameters
弃用
非标
|
Chrome No | Edge No |
Firefox
39
Disabled
|
IE No | Opera No | Safari No | WebView Android No |
Chrome Android
62
|
Firefox Android
44
|
Opera Android No | Safari iOS No | Samsung Internet Android 8.0 |
setFieldOfView
弃用
非标
|
Chrome No | Edge No |
Firefox
39
Disabled
|
IE No | Opera No | Safari No | WebView Android No |
Chrome Android
62
|
Firefox Android
44
|
Opera Android No | Safari iOS No | Samsung Internet Android 8.0 |
完整支持
不支持
非标。预期跨浏览器支持较差。
弃用。不要用于新网站。
见实现注意事项。
用户必须明确启用此特征。