files/en-us/web/api/xrmediabinding/createcylinderlayer/index.md
{{APIRef("WebXR Device API")}}{{SeeCompatTable}}
The createCylinderLayer() method of the {{domxref("XRMediaBinding")}} interface returns an {{domxref("XRCylinderLayer")}} object which is a layer that takes up a curved rectangular space in the virtual environment.
createCylinderLayer(video, options)
video
options
space is required:
aspectRatio {{optional_inline}}
radius with the centralAngle.centralAngle {{optional_inline}}
0.78539 (π / 4).invertStereo {{optional_inline}}
false.layout {{optional_inline}}
default
mono
stereo
texture-array texture type for stereo layouts.stereo-left-right
stereo-top-bottom
mono.radius {{optional_inline}}
2.0.space Required
transform {{optional_inline}}
space.An {{domxref("XRCylinderLayer")}} object.
XRCylinderLayer to display a videoCreate an {{domxref("XRMediaBinding")}} and use an {{domxref("HTMLVideoElement")}} that is passed into createCylinderLayer(). 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.createCylinderLayer(video, {
space: xrReferenceSpace,
});
xrSession.updateRenderState({
layers: [videoLayer],
});
}
{{Specifications}}
{{Compat}}