Skip to content

Conversation

@gfodor
Copy link
Contributor

@gfodor gfodor commented Mar 13, 2019

The code currently has two hacks dealing with WebVR startup in A-Frame when a user refreshes the page after a VR session on desktop:

  • It's always been the case that A-Frame/WebVR will retain VR mode across refreshes, we have a hack that will exit VR mode on startup if this case is hit

  • There was a regression in 0.9.0 that causes A-Frame to miss this condition in certain conditions, resulting in a situation where the display is presenting but A-Frame did not run its relevant "enter VR" routines (to tag the scene metadata, set up cameras, etc.)

The previous hacks handled these cases by subscribing to enter-vr and vrdisplaypresentchange to get out ahead of these conditions, but in practice it looks like in certain cases these event subscriptions are happening too late, the events have already fired (for both conditions.) This PR updates them to both be handled when these events fire but also pre-emptively run the necessary logic at event subscription time in case the event has already fired.

@gfodor gfodor requested a review from netpro2k March 13, 2019 07:00
@dmarcos
Copy link

dmarcos commented Mar 14, 2019

A hack should not be necessary. vrdisplayactivate handler is attached early before the scene initializes: https://github.com/aframevr/aframe/blob/master/src/core/scene/loadingScreen.js#L13

It this is not working as expected we should fix it. Would you mind opening an issue on A-Frame with steps to reproduce?

@gfodor
Copy link
Contributor Author

gfodor commented Mar 21, 2019

Yup, I will try to isolate the root cause -- this PR is meant to un-break hubs. The first "hack" we have is not working around a bug (though it'd be nice to have an option to disable this behavior in A-Frame) -- the latter is definitely a bug.

@gfodor
Copy link
Contributor Author

gfodor commented Mar 21, 2019

Also, if you'd like to look into this before I am able to try to isolate a test case, the behavior we are seeing specifically is that when refreshing the page after a VR session, with some probability A-Frame will have not flipped the scene into vr-mode properly on page load.

@dmarcos
Copy link

dmarcos commented Mar 21, 2019

Try A-Frame master. This might help: aframevr/aframe#4093

@gfodor
Copy link
Contributor Author

gfodor commented Mar 21, 2019

Ah great, will report back here later with results!

@gfodor
Copy link
Contributor Author

gfodor commented Mar 22, 2019

OK good news, if I cherry pick that commit it looks like the issue we were seeing is resolved and the scene is properly in vr-mode if the page is refreshed and the display is active. The other part of this PR is still relevant (for our application to exit VR mode in this condition) but I'll cut another PR for that. Thanks for the support!

@gfodor gfodor closed this Mar 22, 2019
@brianpeiris brianpeiris deleted the bug/aframe-webvr-startup-bug-2 branch August 9, 2022 03:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants