BabylonJS/Babylon.js · error
XRSession.pauseDepthSensing is not supported by this XR runt
Error message
XRSession.pauseDepthSensing is not supported by this XR runtime.
What it means
XRSession.pauseDepthSensing is an optional method from the WebXR depth-sensing spec that not every runtime implements. Babylon checks `typeof session.pauseDepthSensing !== "function"` and throws this Error when the active runtime lacks it, even though a session is running. It signals an API-capability gap, not a session-state problem.
Source
Thrown at packages/dev/core/src/XR/features/WebXRDepthSensing.pure.ts:557
*/
public get isDepthSensingActive(): boolean {
const session: IWebXRDepthSensingSession | undefined = this._xrSessionManager.session;
return this._xrSessionManager.inXRSession && session?.depthActive === true;
}
/**
* Pauses depth sensing for the active XR session.
* @returns A promise that resolves when the native pause operation completes.
* @throws If there is no active XR session or pausing depth sensing is not supported by the runtime.
* @see https://immersive-web.github.io/depth-sensing/
*/
public async pauseDepthSensingAsync(): Promise<void> {
const session: IWebXRDepthSensingSession | undefined = this._xrSessionManager.session;
if (!this._xrSessionManager.inXRSession || !session) {
throw new Error("Pausing WebXR depth sensing requires an active XR session.");
}
if (typeof session.pauseDepthSensing !== "function") {
throw new Error("XRSession.pauseDepthSensing is not supported by this XR runtime.");
}
return await session.pauseDepthSensing();
}
/**
* Resumes depth sensing for the active XR session.
* @returns A promise that resolves when the native resume operation completes.
* @throws If there is no active XR session or resuming depth sensing is not supported by the runtime.
* @see https://immersive-web.github.io/depth-sensing/
*/
public async resumeDepthSensingAsync(): Promise<void> {
const session: IWebXRDepthSensingSession | undefined = this._xrSessionManager.session;
if (!this._xrSessionManager.inXRSession || !session) {
throw new Error("Resuming WebXR depth sensing requires an active XR session.");
}
if (typeof session.resumeDepthSensing !== "function") {
throw new Error("XRSession.resumeDepthSensing is not supported by this XR runtime.");
}
View on GitHub (pinned to 0592b347b8)
Solutions
- Feature-detect first: `typeof xrSessionManager.session?.pauseDepthSensing === "function"` and show/disable the pause control accordingly.
- Wrap the call in try/catch and treat unsupported pause as a no-op with a warning.
- Update to a runtime that supports XRSession.pauseDepthSensing, or avoid depending on pause/resume behavior.
- Gate the feature using the depth-sensing capability info from the session's enabledFeatures if available.
Example fix
// before
await depthSensing.pauseDepthSensingAsync();
// after
const session = xrSessionManager.session;
if (typeof session?.pauseDepthSensing === "function") {
await depthSensing.pauseDepthSensingAsync();
} else {
console.warn("pauseDepthSensing unsupported by this runtime");
} Defensive patterns
Strategy: type-guard
Validate before calling
const canPause = typeof xrSessionManager.session?.pauseDepthSensing === "function";
if (!canPause) { /* disable pause control or no-op */ } Type guard
function supportsPauseDepthSensing(session: XRSession | undefined): session is XRSession & { pauseDepthSensing(): Promise<void> } {
return typeof session?.pauseDepthSensing === "function";
} Try / catch
try {
await depthSensing.pauseDepthSensingAsync();
} catch (e) {
if (String((e as Error).message).includes("not supported by this XR runtime")) {
console.warn("pauseDepthSensing unsupported; continuing without pause");
} else { throw e; }
} Prevention
- Feature-detect optional depth-sensing methods per session
- Treat pause/resume as progressive enhancement, not a requirement
- Check the runtime/device matrix for depth-sensing API coverage
- Catch and no-op capability errors in shared depth-sensing helpers
When it happens
Trigger: Calling pauseDepthSensingAsync() during a live session whose XRSession does not expose pauseDepthSensing (runtime implemented depth-sensing but not the pause/resume extension methods).
Common situations: Headset browsers that shipped depth sensing without pause/resume support; experimental/spec-draft builds where the method names changed; testing on emulators or polyfills that omit the optional methods.
Related errors
- XRSession.resumeDepthSensing is not supported by this XR run
- Deleting persistent anchors is not supported in this environ
- XRCompositionLayer.${control} is not supported by this XR ru
- Anchors not enabled in this environment/browser
- Persistent anchor enumeration is not supported in this envir
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/b0fe7a81a7a68f16.
Report an issue: GitHub.