Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
webvr-polyfill
Advanced tools
Use WebVR today, on mobile or desktop, without requiring a special browser build.
A JavaScript implementation of the WebVR spec. This project ensures your WebVR content works on any platform, whether or not the browser/device has native WebVR support, or when there are inconsistencies in implementation.
Take a look at basic WebVR samples that use this polyfill.
Download the build at build/webvr-polyfill.js and include it as a script tag,
or use a CDN. You can also use the minified file in the same location as webvr-polyfill.min.js
.
<script src='webvr-polyfill.js'></script>
<!-- or use a link to a CDN -->
<script src='https://cdn.jsdelivr.net/npm/webvr-polyfill@latest/build/webvr-polyfill.js'></script>
If you're using a build tool like browserify or webpack, install it via npm.
$ npm install --save webvr-polyfill
Instructions for using versions >=0.10.0
. For <=0.9.x
versions, see 0.9.40 tag.
The webvr-polyfill exposes a single constructor, WebVRPolyfill
that takes an
object for configuration. See full configuration options at src/config.js.
Be sure to instantiate the polyfill before calling any of your VR code! The polyfill needs to patch the API if it does not exist so your content code can assume that the WebVR API will just work.
If using script tags, a WebVRPolyfill
global constructor will exist.
var polyfill = new WebVRPolyfill();
In a modular ES6 world, import and instantiate the constructor similarly.
import WebVRPolyfill from 'webvr-polyfill';
const polyfill = WebVRPolyfill();
The polyfill's goal is to provide a library so that developers can create content targeting the WebVR API without worrying about what browsers and devices their users have in a world of growing, but fragmented support.
The three main components of the polyfill are:
PROVIDE_MOBILE_VRDISPLAY
is true (default).Performance is critical for VR. If you find your application is too sluggish,
consider tweaking some of the above parameters. In particular, keeping
BUFFER_SCALE
at 0.5 (the default) will likely help a lot.
If you're interested in developing and contributing on the polyfill itself, you'll need to
have npm installed and familiarize yourself with some commands below. For full list
of commands available, see package.json
scripts.
$ git clone git@github.com:googlevr/webvr-polyfill.git
$ cd webvr-polyfill/
# Install dependencies
$ npm install
# Build uncompressed JS file
$ npm run build
# Run tests
$ npm test
# Watch src/* directory and auto-rebuild on changes
$ npm watch
Right now there are some unit tests in the configuration and logic for how things get polyfilled. Be sure to run tests before submitting any PRs, and bonus points for having new tests!
$ npm test
Due to the nature of the polyfill, be also sure to test the examples with your changes where appropriate.
For maintainers only, to cut a new release for npm, use the [npm version] command. The preversion
, version
and postversion
npm scripts will run tests, build, add built files and tag to git, push to github, and publish the new npm version.
npm version <semverstring>
This program is free software for both commercial and non-commercial use, distributed under the Apache 2.0 License.
FAQs
Use WebVR today, on mobile or desktop, without requiring a special browser build.
We found that webvr-polyfill demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.