files/en-us/web/api/xrmediabinding/createequirectlayer/index.md
{{APIRef("WebXR Device API")}}{{SeeCompatTable}}
The createEquirectLayer() method of the {{domxref("XRMediaBinding")}} interface returns an {{domxref("XREquirectLayer")}} object which is a layer that maps an equirectangular coded data onto the inside of a sphere.
createEquirectLayer(video, options)
video
options
space is required:
centralHorizontalAngle {{optional_inline}}
6.28318 (2π).invertStereo {{optional_inline}}
false.layout {{optional_inline}}
default
mono
stereo
texture-array texture type for stereo layouts.stereo-left-right
stereo-top-bottom
mono.lowerVerticalAngle {{optional_inline}}
-1.570795 (-π/2).radius {{optional_inline}}
0.0.space Required
transform {{optional_inline}}
space.upperVerticalAngle {{optional_inline}}
1.570795 (π/2).An {{domxref("XREquirectLayer")}} object.
XREquirectLayer to display a videoCreate an {{domxref("XRMediaBinding")}} and use an {{domxref("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 {{domxref("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],
});
}
{{Specifications}}
{{Compat}}