Description
An external developer asked us to send better visibility events. They want to pause video as soon as the user takes off the headset but currently, the visibility event doesn't happen until the headset sits idle for a short while.
This is because we tie the WebXR session visibility to the visibility state of the internal OpenXR session and not to if the headset is on the user's head..
The WebXR and OpenXR specs both state that visibility is tied to if the user can see the scene, but that is not the case for Quest. In addition, Quest can still report poses even if the display is turned off but the session is still active.
The WebXR spec states: A state of hidden indicates that imagery rendered by the XRSession cannot be seen by the user. requestAnimationFrame() callbacks will not be processed until the visibility state changes. Input is not processed by the XRSession.
so if I tie visibility to the mounted state of the headset, that would violate the spec (because we keep firing raf calls). I also worry that changing this will also break some sites.
Alternatively, I can add a boolean on the session that states if the headset is currently worn and update the normative text that says that visible or visible-blurred frames may not be shown to the user (which is Quest's current behavior).
Thoughts, @AdaRoseCannon or @toji