• Add a listener that fires before an XR session is requested. Use this to modify the session init options, e.g. to add optional features like camera-access.

    Parameters

    • fn: (args: XRSessionRequestEventArgs) => void

      The function to call before the XR session is requested

    Returns () => void

    A function to remove the listener

    onBeforeXRSession((args) => {
    args.init.optionalFeatures ??= [];
    args.init.optionalFeatures.push("camera-access");
    });