Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The XRMediaBinding() constructor creates and returns a new XRMediaBinding object.
new XRMediaBinding(session)sessionAn XRSession object specifying the WebXR session for which to create the media binding.
A newly-created XRMediaBinding.
InvalidStateError DOMExceptionThrown if the new XRMediaBinding could not be created due to one of a number of possible state errors:
XRSession specified by session has already been stopped.session is not immersive.XRMediaBindingThe following example creates a new media binding for a session to create an XRQuadLayer to display a video layer in the scene.
const xrMediaBinding = new XRMediaBinding(xrSession);
const video = document.createElement("video");
video.src = "just-fascination.mp4";
const layer = xrMediaBinding.createQuadLayer(video);