Initial WebXR position same as camera position

I found a problem where the WebXR position doesn’t match the camera position when launching. Its facing to the left or right. There seems to be noway to reset it. Any ideas ? Its working on the stereo vr example but not the equi example.

https://dev.electroteque.org.s3.amazonaws.com/three/examples/webgl_video_panorama_equirectangular.html

Another example without camera position code. It defaults to this tilted view like in the webxr session. My own videos have the same problem when orbitcontrols is disabled. How to correct this ?

https://dev.electroteque.org.s3.amazonaws.com/three/examples/webgl_video_panorama_equirectangular2.html

I believe this is what I need to do. Ive tried everything including something like this

renderer.xr.addEventListener(‘sessionstart’, () => {

                renderer.xr.getCamera().position.copy( camera.position);

                renderer.xr.getCamera().lookAt( camera.target );

                //camera.position.copy(renderer.xr.getCamera().position);

                console.log("pos", renderer.xr.getCamera().position);

            });

This is very strange, without a position set, the video starts 90 degrees to the real front of the camera. but in webxr it starts 180 degrees from that position. WebXR camera really needs to take the initial position from the non webxr camera. Even if I shift the geometry instead. It will show flipped in webxr and you need to turn the headset to the left.

https://dev.electroteque.org.s3.amazonaws.com/three/examples/webgl_video_panorama_equirectangular.html

Another test with a rotated mesh. WebXR starts in the opposite direction.

Does this code need an offset added to get the front of the camera ?

camera.matrix.fromArray( view.transform.matrix );
camera.projectionMatrix.fromArray( view.projectionMatrix );

https://dev.electroteque.org.s3.amazonaws.com/three/examples/webgl_video_panorama_equirectangular3.html

I made another test that provides a quick fix. I position the camera to the front. Then I have to flip the mesh in webXR and the opposite direction. Then move it back.

renderer.xr.addEventListener('sessionstart', () => {

                mesh.rotation.y =  -pos;

                renderer.xr.getCamera().position.copy( camera.target);

                renderer.xr.getCamera().lookAt( camera.target );

              

            });

            renderer.xr.addEventListener('sessionend', () => {

                mesh.rotation.y =  0;

                camera.position.x = pos;

  
            });

https://dev.electroteque.org.s3.amazonaws.com/three/examples/webgl_video_panorama_equirectangular4.html