navigation icon indicating copy to clipboard operation
navigation copied to clipboard

Proposed API doesn't allow content to request XR features

Open asajeffrey opened this issue 4 years ago • 2 comments

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 avatar Jul 10 '20 17:07 asajeffrey

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) => { ... })
});

asajeffrey avatar Jul 10 '20 17:07 asajeffrey

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.

Manishearth avatar Jul 13 '20 20:07 Manishearth