meta-quest / immersive-web-emulator

Browser extension that emulates Meta Quest devices for WebXR development. Lead: Felix Zhang (fe1ix@meta.com)
https://developer.oculus.com/blog/webxr-development-immersive-web-emulator/
MIT License
298 stars 34 forks source link

Expose the emulator to make it usable as an API, straight from the browser page #8

Open Utopiah opened 1 year ago

Utopiah commented 1 year ago

Clicking on button is nice but for testing not ideal. As mentioned in https://github.com/MozillaReality/WebXR-emulator-extension/issues/296 being able to make calls directly from the browser console allows for testing programmatically, that means tests could be provided with the WebXR page itself and make the development cycle more efficient.

felixtrz commented 1 year ago

Clicking on button is nice but for testing not ideal. As mentioned in https://github.com/MozillaReality/WebXR-emulator-extension/issues/296 being able to make calls directly from the browser console allows for testing programmatically, that means tests could be provided with the WebXR page itself and make the development cycle more efficient.

Happy to expose these if people will find them useful, and it should be easy to do. Can you suggest a list of APIs and their signatures?

Ledzz commented 1 year ago

Hello @felixtrz ! +1 to this feature. I've been modifying the immersive-web emulator polyfill so it can be added to a page without extension, just like a library. It is useful when dealing with running tests in headless mode in CI. For now, I'm using the api that immersive-web polyfill is providing - just sending some CustomEvents, like "webxr-input-pose" or "webxr-pose" for example. But it would be more convenient, if I could just do something like this:

const polyfill = new WebXRPolyfill();

polyfill.setPose({position: new Vector3(), quaternion: new Quaternion()});
polyfill.controllers.right.setPose({position: new Vector3(), quaternion: new Quaternion()});
poyfill.controllers.right.click();

Please note it's just a pseudocode. Also I think this library should be usable without threejs in client app, just used threejs primitives for an example.

Ledzz commented 1 year ago

@felixtrz if it is ok for you, we can make a draft PR in like a week or two with our proposal. But we are glad to hear everybody's opinion!

mikemainguy commented 11 months ago

I really really want to be able to do this for a) automated testing b) using ps5 controller to use joysticks/buttons/pose. Still looking at other workarounds with exisitng codebase.

kalegd commented 6 months ago

+1 on being vital for automated testing