immersive-web / navigation

Repository for the discussion and research in to navigating from page to page whilst staying in immersive mode. Feature leads: Rik Cabanier and Brandon Jones
Other
70 stars 9 forks source link

Proposed API doesn't allow content to request XR features #10

Open asajeffrey opened 4 years ago

asajeffrey commented 4 years ago

The API proposal at https://github.com/immersive-web/navigation#api-proposal is a sessiongranted event that contains a session field. This means that content has no way to control the initialization of the session, and in particular can't request feature (https://immersive-web.github.io/webxr/#feature-dependencies).

asajeffrey commented 4 years ago

An alternative API is to add a sessionavailable event, which the UA can fire at document load, which the UA uses to signal to the content that there is user intent to enter a session (https://immersive-web.github.io/webxr/#user-intention).

Using the API would look like (following the example in the proposal:

navigator.xr.addEventListener('sessionavailable', (evt) => {
   navigator.xr.requestSession('immersive-vr').then((session) => { ... })
});
Manishearth commented 4 years ago

Note: the spec makes it possible for the permissions API to be used to request features mid-session. However I don't think anyone implements this yet?

Also some features, like layers and secondary views, must be requested at the beginning of the session.