From d6de576281d05a94042a7f25f385f799206c1f3b Mon Sep 17 00:00:00 2001
From: Rik Cabanier <cabanier@meta.com>
Date: Mon, 17 Jul 2023 22:54:53 +0000
Subject: [PATCH] call offsersession after exiting immersive

---
 input-selection-2.html | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/input-selection-2.html b/input-selection-2.html
index 4c307d4..f2b480c 100644
--- a/input-selection-2.html
+++ b/input-selection-2.html
@@ -308,6 +308,16 @@
       function onSessionEnded(event) {
         if (event.session.isImmersive) {
           xrButton.setSession(null);
+
+          if (navigator.xr.offerSession !== undefined) {
+            navigator.xr.offerSession('immersive-vr', {
+              requiredFeatures: ['local-floor']
+            }).then((session) => {
+              xrButton.setSession(session);
+              session.isImmersive = true;
+              onSessionStarted(session);
+            });
+          }
         }
       }