Virtual Reality (VR) and Augmented reality (AR) are becoming the new trend. Everyone is trying it out to have experiences they couldn’t have before while sitting on their couch. Because of it, the developers build VR and AR applications for both desktop and web platforms.
Since every application consumes APIs in some form, the VR and AR web applications are no different. There is a built-in browser API that provides you with various features to help you develop these applications. It’s called WebXR Device API. Let’s take a look.
The XR in the WebXR Device API stands for Cross Reality which is the term for VR and AR when referred to collectively. This web API is designed to help you bring AR and VR to the web. It provides you access to the input and output capabilities of AR and VR-enabled devices. These devices are generally mobile devices that can be plugged into a headset. The API also helps render 3D scenery in the VR and AR supported devices.
The WebXR Device API is a complete package that further provides many features to handle frame loop, pose, depth-sensing, light estimation in a 3D scene, geometric primitives, etc.
Let’s take a quick look at some of the use cases of the WebXR Device API.
Using the WebXR Device API, you can visualize the data in 3D inside a VR headset instead of the traditional 2D model. Developers can also use this API to render 3D interactive items on their e-commerce website.
The API can help render an XR video in a supported XR video player. If the browser supports the API, the user will see an icon at the bottom of the video player to enable the View in VR feature.
As of writing this piece, the API is only supported on the desktop and mobile versions of Chrome, Edge, and Opera. If a site consumes this API, its features will not work on Firefox and Safari.