WebXR Device API
The XRMediaBinding() constructor creates and returns a new XRMediaBinding object.
Syntax
new XRMediaBinding(session)
Parameters
session- : An XRSession object specifying the WebXR session for which to create the media binding.
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 XRSession specified by
sessionhas already been stopped. - The specified
sessionis not immersive.
- The XRSession specified by
- : Thrown if the new
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.
const xrMediaBinding = new XRMediaBinding(xrSession);
const video = document.createElement("video");
video.src = "just-fascination.mp4";
const layer = xrMediaBinding.createQuadLayer(video);
Specifications
Browser compatibility
See also
- XRWebGLBinding
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
