-
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
Introduce navigator.xr.getAvailability
method
#184
Comments
The availability of the API has to do with whether a) it is allowed from a policy standpoint and b) whether there are VR displays plugged in. Unless I am missing something, A should be able to be determined synchronously. Since we already have getVRDisplays and the connected event for B, why can't availability be exposed as a synchronous attribute instead of be promised based? The FullScreen feature, which you did not mention, has availability as the fullscreenenabled attribute. |
I haven't looked at the Chromium and Firefox sources for the WebVR management, but IIRC we engage VR mode when a call is made to I may be misunderstanding how we're deriving intent (and ability) to use VR. What's to prevent unnecessary polling when a VR headset not be plugged in (despite the HMDs' SDKs being present on the machine) or the majority of sites (for the time being) a user access won't be WebVR-capable? For what it's worth, other APIs seem to handle this by gating permissions to powerful APIs with the Permissions API, with calls to This could be a synchronous property (note that @toji did add Related to this: there's issue #86 on file for handling |
I agree that starting the VR machinery is something user agents should postpone as late as possible. Up to this point, I've been considering the act of hooking the If we do not want to tackle permissions APIs, what does getAvailability buy us that we don't already have with the existing mechanisms? |
Hello!
The Firefox implementation already behaves as you describe. It avoids activating any VR hardware until either the events are hooked or getVRDisplays is called.
I would be in support of defining this behaviour in the spec, but open to hear of advantage to making this more explicit.
Cheers,
Kearwood "Kip" Gilbert
…Sent from my iPad
On Feb 8, 2017, at 6:04 PM, Rafael Cintron ***@***.***> wrote:
I agree that starting the VR machinery is something user agents should postpone as late as possible. Up to this point, I've been considering the act of hooking the displayconnect/displaydisconnect events and/or calling getVRDisplays as the signal to do this startup.
If we do not want to tackle permissions APIs, what does getAvailability buy us that we don't already have with the existing mechanisms?
―
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I think Feature Policy could be handled by making Other than that, what specific use cases would we need to decide the availability of the WebVR API? The Web Bluetooth and Presentation API uses seem slightly different - the former is querying Bluetooth support (there is no |
Is there a reason for the dependency issue? Is there harm in using the permission API and auto granting the permission, so that in future the UA can decide if they want to behave differently. Especially as this would also give the event for change out of the box. |
Yes, the UA could automatically set the state as 👍 from me on that |
@toji: @NellWaliczek: Ought we to remove this in favour of |
navigator.vr.getAvailability
method (as successor to navigator.vrEnabled
)navigator.xr.getAvailability
method
Is there still a need for a On a related note: I filed a new issue to define the behaviour and improve documentation of the If folks agree, we can keep the discussion to #322 and close this issue. Let me know. Thanks! |
Closing to take the suggestion to keep the discussion in #322 |
I'm aware that in existing Chromium/Firefox implementations, WebVR intent was gated on
navigator.getVRDisplays
(e.g., VR controllers won't be enumerated when callednavigator.getGamepads()
unless there was a prior call tonavigator.getVRDisplays
). Implementations of the Gamepad API have similar heuristics:If there exists a listener for a
gamepadconnected
event, or there is a call tonavigator.getGampads()
, then the Gamepad code path is engaged in the browser.navigator.vr.getAvailability()
should follow an algorithm that resolves aPromise<boolean>
, with the boolean indicating whether the UA supports (or allows) VR in the current browsing context/document (i.e., not simply whether a VR device has been found).Developers could listen to an event
availabilitychange
fired onnavigator.vr
. This would also respect theFeature-Policy
(<iframe enable="vr">
), which is described in detail in issue #25.I researched Web Bluetooth, WebUSB, Presentation API, Web Audio, Web MIDI, among others, and found them to support similar methods:
I want to remind that the Permissions API is likely a good candidate to adopt if it's decided that we ought to gate VR access to explicit user permission. For now, let's leave that off the table.
The text was updated successfully, but these errors were encountered: