XRView: isFirstPersonObserver property
The XRView
interface's read-only isFirstPersonObserver
property is a boolean indicating if the XRView
is a first-person observer view.
To create video recordings of AR device cameras, you can't simply use one of the rendered eyes, as there often will be a physical offset. Some devices expose a secondary view, the first-person observer view, which has an eye
of none
.
To receive a first-person observer view, you need to enable the "secondary-views" feature descriptor explicitly (typically as an optional feature). See XRSystem.requestSession()
for details.
The isFirstPersonObserver
property then allows you to check which secondary view is a first-person observer view.
Examples
Checking for first-person observer views
navigator.xr
.requestSession("immersive-ar", {
optionalFeatures: ["secondary-views"],
})
.then((session) => {
session.requestAnimationFrame((frame) => {
const views = frame.getViewerPose(space);
for (const view of views) {
if (view.isFirstPersonObserver) {
renderFPO();
} else {
render();
}
}
});
});
Specifications
Browser compatibility
|
Desktop |
Mobile |
|
Chrome |
Edge |
Firefox |
Internet Explorer |
Opera |
Safari |
WebView Android |
Chrome Android |
Firefox for Android |
Opera Android |
Safari on IOS |
Samsung Internet |
isFirstPersonObserver |
86Always returns false since no headset with first-person view is supported.
|
86Always returns false since no headset with first-person view is supported.
|
No |
No |
72Always returns false since no headset with first-person view is supported.
|
No |
No |
86Always returns false since no headset with first-person view is supported.
|
No |
61Always returns false since no headset with first-person view is supported.
|
No |
13.0Always returns false since no headset with first-person view is supported.
|