Closed Findus79 closed 1 year ago
Hello,
Today, you can detect that the headset is going to sleep based on receiving the XR_SESSION_STATE_EXITING
. This is because handling of the headset going to sleep is similar to the headset being un-plugged. In the BasicXrApp, this event is causing the application to terminate its main loop and exit, hence the behavior you are seeing.
After handling this event, you have the choice to continue running your app in the background and/or in 2D mode rather than exiting. You can then offer to the user the ability to resume the VR experience, for example exposing a button in a 2D window to re-enter VR. This button shall create and begin a new XrSession, which will automatically wake up the headset.
You may look at the SampleSceneWin32 sample. which has a 2D window offering Enter/Exit VR. Upon the headset going to sleep, that 2D window stays open, and clicking Enter VR will allow the user to re-enter VR either before waking up the headset (which will wake it up) or after they woke up the headset manually.
Thank you, that helps a lot :)
When running BasicXRApp and the VR Device goes to sleep, the application exits. Is there a sample where devices going to sleep and waking up again are properly handled?