XRMediaBinding()

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

InvalidStateError

The new XRMediaBinding could not be created due to one of a number of possible state errors:

  • The XRSession specified by session has already been stopped.
  • The specified session is not immersive.

Example

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

No specification found

No specification data found for api.XRMediaBinding.XRMediaBinding.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Browser compatibility

No compatibility data found for api.XRMediaBinding.XRMediaBinding.
Check for problems with this page or contribute missing data to mdn/browser-compat-data.

See also