{"record":{"id":"b0fe7a81a7a68f16","repo":"BabylonJS/Babylon.js","slug":"xrsession-pausedepthsensing-is-not-supported-by-th","errorCode":null,"errorMessage":"XRSession.pauseDepthSensing is not supported by this XR runtime.","messagePattern":"XRSession\\.pauseDepthSensing is not supported by this XR runtime\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/XR/features/WebXRDepthSensing.pure.ts","lineNumber":557,"sourceCode":"     */\r\n    public get isDepthSensingActive(): boolean {\r\n        const session: IWebXRDepthSensingSession | undefined = this._xrSessionManager.session;\r\n        return this._xrSessionManager.inXRSession && session?.depthActive === true;\r\n    }\r\n\r\n    /**\r\n     * Pauses depth sensing for the active XR session.\r\n     * @returns A promise that resolves when the native pause operation completes.\r\n     * @throws If there is no active XR session or pausing depth sensing is not supported by the runtime.\r\n     * @see https://immersive-web.github.io/depth-sensing/\r\n     */\r\n    public async pauseDepthSensingAsync(): Promise<void> {\r\n        const session: IWebXRDepthSensingSession | undefined = this._xrSessionManager.session;\r\n        if (!this._xrSessionManager.inXRSession || !session) {\r\n            throw new Error(\"Pausing WebXR depth sensing requires an active XR session.\");\r\n        }\r\n        if (typeof session.pauseDepthSensing !== \"function\") {\r\n            throw new Error(\"XRSession.pauseDepthSensing is not supported by this XR runtime.\");\r\n        }\r\n        return await session.pauseDepthSensing();\r\n    }\r\n\r\n    /**\r\n     * Resumes depth sensing for the active XR session.\r\n     * @returns A promise that resolves when the native resume operation completes.\r\n     * @throws If there is no active XR session or resuming depth sensing is not supported by the runtime.\r\n     * @see https://immersive-web.github.io/depth-sensing/\r\n     */\r\n    public async resumeDepthSensingAsync(): Promise<void> {\r\n        const session: IWebXRDepthSensingSession | undefined = this._xrSessionManager.session;\r\n        if (!this._xrSessionManager.inXRSession || !session) {\r\n            throw new Error(\"Resuming WebXR depth sensing requires an active XR session.\");\r\n        }\r\n        if (typeof session.resumeDepthSensing !== \"function\") {\r\n            throw new Error(\"XRSession.resumeDepthSensing is not supported by this XR runtime.\");\r\n        }\r","sourceCodeStart":539,"sourceCodeEnd":575,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/XR/features/WebXRDepthSensing.pure.ts#L539-L575","documentation":"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.","triggerScenarios":"Calling pauseDepthSensingAsync() during a live session whose XRSession does not expose pauseDepthSensing (runtime implemented depth-sensing but not the pause/resume extension methods).","commonSituations":"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.","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."],"exampleFix":"// before\nawait depthSensing.pauseDepthSensingAsync();\n// after\nconst session = xrSessionManager.session;\nif (typeof session?.pauseDepthSensing === \"function\") {\n    await depthSensing.pauseDepthSensingAsync();\n} else {\n    console.warn(\"pauseDepthSensing unsupported by this runtime\");\n}","handlingStrategy":"type-guard","validationCode":"const canPause = typeof xrSessionManager.session?.pauseDepthSensing === \"function\";\nif (!canPause) { /* disable pause control or no-op */ }","typeGuard":"function supportsPauseDepthSensing(session: XRSession | undefined): session is XRSession & { pauseDepthSensing(): Promise<void> } {\n    return typeof session?.pauseDepthSensing === \"function\";\n}","tryCatchPattern":"try {\n    await depthSensing.pauseDepthSensingAsync();\n} catch (e) {\n    if (String((e as Error).message).includes(\"not supported by this XR runtime\")) {\n    console.warn(\"pauseDepthSensing unsupported; continuing without pause\");\n    } else { throw e; }\n}","preventionTips":["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"],"tags":["webxr","depth-sensing","browser-support","feature-detection"],"backgroundTag":"webxr-api-not-supported","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}