WebXR Image detection method causing issues

Hi there,

I’m developing a WebXR-compatible WebAR SDK ( https://launch.variant3d.com ) and have recently added image-tracking support in-line with Chrome Android’s implementation.

However I found that since PlayCanvas detects support via the existence of the XRImageTrackingResult class (regardless of whether that class is ever instantiated in code), and also runs image-tracking setup regardless of whether its requested, Android users who had my SDK on their page would get errors in this section of the engine engine/xr-image-tracking.js at cf28baf6f1ccd5568597946c62c1696a4ad9919e · playcanvas/engine · GitHub as it tried to start image-tracking despite it not being supported (so no getTrackedImageScores).

Could I request a review of this approach, and suggest the transition to a more in-spec isSessionSupported check, or that the image-tracking setup code be gated based on the features enabled on the XRSession object, or wrapped in a try-catch?



Just an addendum, after patching the ability to call getTrackedImageScores before any images have been setup, I’m also finding that getImageTrackingResults is called every frame as well, which causes issues as since an image-tracking session wasn’t requested, basic setup wasn’t done in my SDK.

I’m also chasing down an iOS-specific bug where requestAnimationFrame stops being called within a few seconds of WebXR tracking starting, but I’m not sure if its my SDK side or not yet (the only changes I made in the last week were image-tracking related, but these issues started a few days ago)

Hi Ben,

Would you mind creating an issue for this here: Issues · playcanvas/engine · GitHub
If you have a simple project that can repro the problem and can be used to test the fix, please attach it, that would be very useful.

Also, in order to speed up this fix / change, you’re welcome to create a PR.

Hi - I’ve created an issue and minimal repro here: WebXR Image detection method causing issues on image-tracking enabled browsers · Issue #5365 · playcanvas/engine · GitHub I’ll look at making a PR but I’m not familiar with the project overall so I might be breaking a lot of conventions.

1 Like