The createCylinderLayer()
method of the XRMediaBinding
interface returns an XRCylinderLayer
object which is a layer that takes up a curved rectangular space in the virtual environment.
createCylinderLayer(video, options)
Create an XRMediaBinding
and use an 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 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],
});
}