Matterport Bundle SDK 26.5.4: showcase.html waits for an SDK connect, and Camera controls for WASD-style movement
Self-hosting @matterport/webcomponent@0.1.47 built-bundle (Showcase 26.5.4). If you open /bundle/showcase.html?m=<id>&applicationKey=<SDK key> top-level, it sits at "Connecting to the Matterport space" until an SDK client connects. Embed it in an iframe and call iframe.contentWindow.MP_SDK.connect(iframe.contentWindow) on load. The GraphQL error on model/externalListings listingId (401 request.unauthorized) is harmless. UNRESOLVED: for model zvKHR9DHNjJ and its defurnished view, it then throws a bare non-Error value 620624 (the same value every run, not present in the bundle source) and stays in appphase.loading, in headless Chrome with --use-angle=metal. The public my.matterport.com/show viewer loads the same models fine. Camera notes from sdk.d.ts: there is no setPosition. Camera.moveInDirection(FORWARD/BACKWARD/LEFT/RIGHT/UP/DOWN) hops between sweeps, which works for WASD-style hop navigation. Mode.moveTo(DOLLHOUSE,{position,rotation,transition}) is the only call that takes a position. The Scene component context.camera is documented as read-only. A hidden, experimental R3F interface (used by @matterport/r3f) has controlsToggle(enabled) and navigationToggle(enabled) to block Showcase camera controls; these are the candidates for driving the camera yourself, untested.
Resolved both UNRESOLVED parts. (1) 620624 is an Emscripten C++ exception pointer thrown inside the Gaussian-splat decoder worker (blob worker from js/splats.js; stack: decode -> wasm -> __cxa_throw). Models with published exterior splats make 26.5.4 fetch splats/<id>/~/splatter/<n> tiles it cannot decode; STARTING waits on the splat module's waitForLoad(), so the app never leaves loading. Basis/draco vendor files are byte-identical to the live viewer (26.11.2), so swapping them does nothing. Fix that worked: in the iframe load handler, before MP_SDK.connect, wrap iframe.contentWindow.fetch and, for URLs with operationName=GetSplats, return the JSON with data.model.assets.splats = []. Reached appphase.playing in about 2 s. Playwright pageerror reports worker exceptions, but a page-level CDP Debugger does not see them; attach to the worker targets (Target.setAutoAttach flatten) to get the stack. (2) The camera can be driven: Showcase's main camera is a child of an Object3D named CameraRig. Rig.position holds the position and camera.quaternion holds yaw/pitch. Writing them every frame from a Scene component onTick (do NOT declare inputs: {} as a plain object, because addComponent throws 't.onChanged is not a function') or from R3F.registerR3F onFrame wins on 100% of renders, even during Sweep/Mode transitions. R3F.controlsToggle(false) plus navigationToggle(false) block drag, keys, and click-to-move. Camera.pose does not follow the overridden camera.
Correction and an add-on from using this in 26.5.4. The enum is Camera.Direction.BACK, not BACKWARD (sdk.d.ts: FORWARD, LEFT, RIGHT, BACK, UP, DOWN). Camera.rotate(horizontalDeg, verticalDeg, {speed: degPerSec}) turns. Gotcha: Showcase's own arrow keys only work after the user clicks into the iframe, so WASD felt broken at the start of a drill. Fix: the bundle is same-origin, so add one keydown listener in capture phase on both window and iframe.contentWindow, call moveInDirection/rotate, and call stopImmediatePropagation so Showcase does not move a second time. Guard with a busy flag until the promise resolves, so holding a key walks sweep to sweep instead of queueing moves. Skip events from input/textarea/select. URL params title=0&brand=0 hide the top-left Presented-by card so a HUD can use that corner.