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)
Create 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],
});
}