-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Navigation in 2.0 #194
Comments
The only thing I'm not sure about is requiring |
WebGL's context loss handling also uses preventDefault in a similar fashion. The catch with trying to detect "presentation" in a So that means that the action that needs to be taken in the
I don't like option 1 because it makes it easy to erroneously get into a bad state (page is "presenting" but not actually producing frames) unless the developer follows best practices. Options 2 and 3 require clear intent on the part of the page, which is a nice property to have. Option 2 gives the impression that we're keeping a single session alive across multiple navigates (regardless of what's actually happening behind the scenes), which is a nice mental model at the very least and may allow for some cleaner implementations to boot, so I tend to prefer that. |
Why would option 3 be more problematic down the road? My concern with |
Follow up to this that I've been meaning to post for a little while but still had to work out some of the quirks in my head: A colleague of mine, Michael Thiessen, pointed out that at least on Daydream there's some potential issues with the event-based approach for both
Even if the page DOES call So, here's our proposal to make this more predictable and less janky: Rather than (or along with) having pages register for events have them instead describe the scenarios under which they want a new session to be created, and when those situations occur provide a session to the page directly. There's a few models for how this could happen, so I'm just going to pick a couple and run with them. Feel free to suggest alternate interfaces. Event listener style navigator.vr.addSessionListener("navigate", session => { ... });
navigator.vr.addSessionListener("activate", session => { ... }); Provides a familiar model, though it's maybe a bit verbose. Raises questions about whether or not the same interface should exist on the VR singleton (for navigate) and the Device (for activate) or only the singleton. (It could work, but then you're forced to listen for activates from all devices.) Alternately you could have explicit functions for each scenario: navigator.vr.requestSessionOnNavigate(session => { ... });
vrDisplay.requestSessionOnActivate(session => { ... }); Keep in mind that RequestSession args vrDisplay.requestSession({ waitFor: ["navigate", "activate"] }).then(session => { ... }); This model would nicely consolidate everything under Or, you know, maybe this isn't something worth worrying about at all because nobody else is running into issues with the event-based model? Let me know what you think! |
Update: We had a vote on features that should be in scope for WebVR 2.0 today and WebVR-to-WebVR page navigation was voted in. Let's continue iterating on the feature design to work out the issues that have been brought up thus far. |
Consolidating issues: There is related conversation that happened in #30, which is closed now simply to allow this issue to be the top-level bug. |
Closely related to #193 (and #30), which should inform this discussion, but I wanted to talk specifically about API shape in 2.0.
In general I think the timing outline Kip provided (firing after the
load
event) is reasonable, and the restrictions on when it fires discussed in that thread should also carry over. But in the context of 2.0 it would no longer be tied to theactivate
event, and instead be promoted to it's ownnavigate
event that fires off thenavigator.vr
object. My suggestion is that we fire aVREvent
(orVRSessionEvent
) that includes theVRDisplay
that was presenting on the previous page as well as aVRSession
to present with. This actually negates the need to make thenavigate
event a user gesture, since we'd be giving the page a everything it needs to present with.I'd also suggest that we perhaps make it a requirement that pages call
event.preventDefault()
if they're actually going to present in response to the event. This is mostly so that we have a clear point where we can say "Nope, they're not gonna do anything with it, so shut it down." Otherwise we're relying on the garbage collector to clean up the display/session before we know that we can revert back to a 2D version of the page. That's particularly important for responsiveness in VR browsers that mode switch between VR content and traditional 2D content.The text was updated successfully, but these errors were encountered: