The createQuadLayer() method of the XRMediaBinding interface returns an XRQuadLayer object which is a layer that takes up a flat rectangular space in the virtual environment.
createQuadLayer(video, options)
Create an XRMediaBinding and use an HTMLVideoElement that is passed into createQuadLayer(). 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.createQuadLayer(video, {
space: xrReferenceSpace,
});
xrSession.updateRenderState({
layers: [videoLayer],
});
}