XRMediaBinding: XRMediaBinding() constructor
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
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.
Syntax
js
new XRMediaBinding(session)
Parameters
Return value
A newly-created XRMediaBinding.
Exceptions
InvalidStateErrorDOMException-
Thrown if the new
XRMediaBindingcould not be created due to one of a number of possible state errors:- The
XRSessionspecified bysessionhas already been stopped. - The specified
sessionis not immersive.
- The
Examples
>Creating a new XRMediaBinding
The following example creates a new media binding for a session to create an XRQuadLayer to display a video layer in the scene.
js
const xrMediaBinding = new XRMediaBinding(xrSession);
const video = document.createElement("video");
video.src = "just-fascination.mp4";
const layer = xrMediaBinding.createQuadLayer(video);
Specifications
| Specification |
|---|
| WebXR Layers API Level 1> # dom-xrmediabinding-xrmediabinding> |
Browser compatibility
Loading…