VRDisplay.displayId
Experimental
これは実験的な機能です。
本番で使用する前にブラウザー互換性一覧表をチェックしてください。
VRDisplay
インターフェイスの displayId
読み取り専用プロパティは、この特定の VRDisplay
の識別子を返します。これは、 Gamepad API の関連付けポイントとしても使用されます( Gamepad.displayId
を参照)。
構文
var myDisplayID = vrDisplayInstance.displayId;
値
特定の VRDisplay
のIDを表す番号。
例
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 displayId の定義 |
ドラフト | 初回定義 |
ブラウザー実装状況
BCD tables only load in the browser
関連項目
- WebVR API homepage
- MozVr.com — demos, downloads, and other resources from the Mozilla VR team.