{"record":{"id":"e07e8a535f0f6c12","repo":"BabylonJS/Babylon.js","slug":"xrsession-resumedepthsensing-is-not-supported-by-t","errorCode":null,"errorMessage":"XRSession.resumeDepthSensing is not supported by this XR runtime.","messagePattern":"XRSession\\.resumeDepthSensing 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":574,"sourceCode":"        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\n        return await session.resumeDepthSensing();\r\n    }\r\n\r\n    /**\r\n     * Latest cached InternalTexture which containing depth buffer information.\r\n     * This can be used when the depth usage is \"gpu\".\r\n     * @deprecated This will be removed in the future. Use latestDepthImageTexture\r\n     */\r\n    public get latestInternalTexture(): Nullable<InternalTexture> {\r\n        if (!this._cachedWebGLTexture) {\r\n            return null;\r\n        }\r\n\r\n        return this._getInternalTextureFromDepthInfo();\r\n    }\r\n\r\n    /**\r","sourceCodeStart":556,"sourceCodeEnd":592,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/XR/features/WebXRDepthSensing.pure.ts#L556-L592","documentation":"XRSession.resumeDepthSensing is optional in the WebXR depth-sensing spec. Babylon verifies `typeof session.resumeDepthSensing === \"function\"` and throws this Error when the runtime, despite having a live session, does not implement resume support. It is a capability error from the browser/runtime, not user code.","triggerScenarios":"Calling resumeDepthSensingAsync() on a session whose XRSession lacks the resumeDepthSensing method (runtime supports depth sensing but not pause/resume controls).","commonSituations":"Older or partial depth-sensing implementations in headset browsers; experimental builds with different API surface; polyfills/emulators missing the optional methods; spec changes between draft and shipped versions.","solutions":["Feature-detect `typeof session?.resumeDepthSensing === \"function\"` before offering resume in UI.","Catch the error and fall back to re-enabling depth sensing via session recreation, or continue without resume.","Update the device runtime/browser to one implementing the full depth-sensing pause/resume API.","Avoid relying on pause/resume in code that must run on all WebXR devices."],"exampleFix":"// before\nawait depthSensing.resumeDepthSensingAsync();\n// after\nconst session = xrSessionManager.session;\nif (typeof session?.resumeDepthSensing === \"function\") {\n    await depthSensing.resumeDepthSensingAsync();\n} else {\n    console.warn(\"resumeDepthSensing unsupported by this runtime\");\n}","handlingStrategy":"type-guard","validationCode":"const canResume = typeof xrSessionManager.session?.resumeDepthSensing === \"function\";\nif (!canResume) { /* hide resume control or fallback */ }","typeGuard":"function supportsResumeDepthSensing(session: XRSession | undefined): session is XRSession & { resumeDepthSensing(): Promise<void> } {\n    return typeof session?.resumeDepthSensing === \"function\";\n}","tryCatchPattern":"try {\n    await depthSensing.resumeDepthSensingAsync();\n} catch (e) {\n    if (String((e as Error).message).includes(\"not supported by this XR runtime\")) {\n    console.warn(\"resumeDepthSensing unsupported; continuing without resume\");\n    } else { throw e; }\n}","preventionTips":["Feature-detect resumeDepthSensing per session","Do not assume symmetric pause/resume support across runtimes","Fall back to session recreation if resume is essential","Pin and test against the device browsers your users actually run"],"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"}