Skip to content
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

WebVR: Better availability check #11320

Merged
merged 1 commit into from
May 14, 2017
Merged

WebVR: Better availability check #11320

merged 1 commit into from
May 14, 2017

Conversation

Mugen87
Copy link
Collaborator

@Mugen87 Mugen87 commented May 11, 2017

This PR introduces a new .checkAvailability() function in in WebVR.js that uses a Promise in order to correctly check the availability of the WebVR API and HMDs.

.isAvailable() returns just a boolean to indicate if WebVR is possible or not. The Promise returned by .checkAvailability() will resolve if everything is fine. If something goes wrong, it rejects with a respective error message.

This approach solves an important issue: .isAvailable() does not indicate if WebVR is supported but no HMD is available. Besides the current workflow does not provide an appropriate error message in this case because the following code is never reached (the value of message is determined in a callback, while the actual function getMessage has already returned).

@Mugen87
Copy link
Collaborator Author

Mugen87 commented May 11, 2017

For testing: Please activate WebVR in your browser settings. The Origin Trial Token does not work with rawgit.

The "Enter VR" button works in the current implementation, but not the message toast.

With PR: http://rawgit.com/mugen87/three.js/webvr/examples/webvr_daydream.html
Current: https://threejs.org/examples/webvr_daydream.html

@mrdoob mrdoob merged commit 5e85ec8 into mrdoob:dev May 14, 2017
@mrdoob
Copy link
Owner

mrdoob commented May 14, 2017

Thanks!

@Mugen87 Mugen87 deleted the webvr branch May 14, 2017 09:13
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.

2 participants