This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The createEquirectLayer() method of the XRMediaBinding interface returns an XREquirectLayer object which is a layer that maps an equirectangular coded data onto the inside of a sphere.
createEquirectLayer(video, options)
videoAn HTMLVideoElement to display.
optionsAn object to configure the XREquirectLayer. The object can have the following properties and space is required:
centralHorizontalAngle OptionalA number indicating the central horizontal angle in radians for the sphere. Default value: 6.28318 (2π).
invertStereo OptionalA boolean specifying if the natural location of each view in the video should be inverted. By default false.
layout OptionalA string indicating the layout of the video. Possible values:
defaultThe layer accommodates all views of the session.
monoA single XRSubImage is allocated and presented to both eyes.
stereoThe user agent decides how it allocates the XRSubImage (one or two) and the layout (top/bottom or left/right). It is recommended to use the texture-array texture type for stereo layouts.
stereo-left-rightA single XRSubImage is allocated. Left eye gets the left area of the texture, right eye the right. This layout is designed to minimize draw calls for content that is already in stereo (for example stereo videos or images).
stereo-top-bottomA single XRSubImage is allocated. Left eye gets the top area of the texture, right eye the bottom. This layout is designed to minimize draw calls for content that is already in stereo (for example stereo videos or images). The default value is mono.
lowerVerticalAngle OptionalA number indicating the lower vertical angle in radians for the sphere. Default value: -1.570795 (-π/2).
radius OptionalA number indicating the radius of the sphere. Default value 0.0.
space RequiredAn XRSpace object defining the layer's spatial relationship with the user's physical environment.
transform OptionalAn XRRigidTransform object defining the offset and orientation relative to space.
upperVerticalAngle OptionalA number indicating the upper vertical angle in radians for the sphere. Default value: 1.570795 (π/2).
An XREquirectLayer object.
XREquirectLayer to display a videoCreate an XRMediaBinding and use an HTMLVideoElement that is passed into createEquirectLayer(). Configure the quad layer using the options listed above and present the layer to the XR device by adding it to the layers render state in XRSession.updateRenderState().
function onXRSessionStarted(xrSession) {
const xrMediaBinding = new XRMediaBinding(xrSession);
const video = document.createElement("video");
video.src = "just-fascination.mp4";
const videoLayer = xrMediaBinding.createEquirectLayer(video, {
space: xrReferenceSpace,
});
xrSession.updateRenderState({
layers: [videoLayer],
});
}
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
createEquirectLayer |
No | No | No | No | No | No | No | No | No | No | No | No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/XRMediaBinding/createEquirectLayer