recursal/MDN huggingface dataset:
MediaKeySession: keystatuseschange event
========================================

The **`keystatuseschange`** event of the `MediaKeySession` API fires when there has been a change in the keys or their statuses within a session.

Syntax
------

Use the event name in methods like `addEventListener()`, or set an event handler property.


```js
addEventListener("keystatuseschange", (event) => {});

onkeystatuseschange = (event) => {};
```

Event type
----------

An `ExtendableEvent`. Inherits from `Event`.

Event

ExtendableEventEvent properties
----------------

*Doesn't implement any specific properties, but inherits properties from its parent, `Event`.*

Specifications
--------------

| Specification |
| --- |
| Encrypted Media Extensions # dom-mediakeysession-onkeystatuseschange |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
MediaKeySession: expiration property
====================================

 The **`MediaKeySession.expiration`** read-only property returns
 the time after which the keys in the current session can no longer be used to decrypt
 media data, or NaN if no such time exists. This value is determined by the CDM and
 measured in milliseconds since January 1, 1970, UTC. This value may change during a
 session lifetime, such as when an action triggers the start of a window.

Value
-----

A number or NaN.

Specifications
--------------

| Specification |
| --- |
| Encrypted Media Extensions # dom-mediakeysession-expiration |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
MediaStreamAudioDestinationNode: stream property
================================================

The `stream` property of the `AudioContext` interface represents a `MediaStream` containing a single audio `MediaStreamTrack` with the same number of channels as the node itself.

You can use this property to get a stream out of the audio graph and feed it into another construct, such as a Media Recorder.

Value
-----

A `MediaStream` containing a single audio track. The audio track is a `MediaStreamTrack` whose `kind` is `audio`.

Examples
--------

See `AudioContext.createMediaStreamDestination()` for example code that creates a `MediaStreamAudioDestinationNode` and uses its `stream` property as a source for audio to be recorded.

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-mediastreamaudiodestinationnode-stream |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* Using the Web Audio API
MediaStreamAudioDestinationNode: MediaStreamAudioDestinationNode() constructor
==============================================================================

The **`MediaStreamAudioDestinationNode()`** constructor of the Web Audio API creates a new `MediaStreamAudioDestinationNode` object instance.

Syntax
------


```js
new MediaStreamAudioDestinationNode(context)
new MediaStreamAudioDestinationNode(context, options)
```

### Parameters

`context`

An `AudioContext` representing the audio context you want the node to be associated with.

`options` Optional

An object defining the properties you want the `MediaStreamAudioDestinationNode` to have:

`channelCount`

 An integer used to determine how many channels are used when
 up-mixing and down-mixing
 connections to any inputs to the node. (See
 `AudioNode.channelCount` for more information.) Its usage and precise
 definition depend on the value of `channelCountMode`.


`channelCountMode`

 A string describing the way channels must be matched between
 the node's inputs and outputs. (See `AudioNode.channelCountMode` for more
 information including default values.)


`channelInterpretation`

 A string describing the meaning of the channels. This interpretation will define how audio
 up-mixing and down-mixing
 will happen. The possible values are `"speakers"` or `"discrete"`. (See
 `AudioNode.channelCountMode` for more information including default
 values.)



Examples
--------


```js
const ac = new AudioContext();

const myDestination = new MediaStreamAudioDestinationNode(ac);
```

Specifications
--------------

| Specification |
| --- |
| Web Audio API # dom-mediastreamaudiodestinationnode-mediastreamaudiodestinationnode |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
HTMLHtmlElement: version property
=================================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

**Note:** This property has been declared as deprecated by the W3C technical recommendation for HTML 4.01 in favor of use of the DTD for obtaining version information for a document.

Returns version information about the document type definition (DTD) of a document. While this property is recognized by Mozilla, the return value for this property is always an empty string.

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
XRSystem: devicechange event
============================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

A **`devicechange`** event is fired on an `XRSystem` object whenever the availability of immersive XR devices has changed; for example, a VR headset or AR goggles have been connected or disconnected. It's a generic `Event` with no added properties.

**Note:** Not to be confused with the `MediaDevices` `devicechange` event.

Syntax
------

Use the event name in methods like `addEventListener()`, or set an event handler property.


```js
addEventListener("devicechange", (event) => {});

ondevicechange = (event) => {};
```


If the use of WebXR has been blocked by an `xr-spatial-tracking` Permissions Policy, `devicechange` events will not fire.

Event type
----------

A generic `Event` with no added properties.

Description
-----------

### Trigger

Triggered whenever the availability of immersive XR devices has changed. For example, when a VR headset or AR goggles have been connected or disconnected.

### Use cases

You can use this event to, for example, monitor for the availability of a WebXR-compatible device so that you can enable a UI element which the user can use to activate immersive mode. This is shown in the example below.

Examples
--------

The example shown here handles the `devicechange` event by toggling the availability of the "Enter XR" button based on whether or not any immersive devices are currently available.


```js
if (navigator.xr) {
  navigator.xr.addEventListener("devicechange", (event) => {
    navigator.xr.isSessionSupported("immersive-vr").then((immersiveOK) => {
      enableXRButton.disabled = !immersiveOK;
    });
  });
}
```


When `devicechange` is received, the handler set up in this code calls the `XR` method `isSessionSupported()` to find out if there's a device available that can handle immersive VR presentations. If there is, the button to enter XR mode is enabled; otherwise it's disabled.

You can also use the `ondevicechange` event handler property to set a single handler for `devicechange` events:


```js
if (navigator.xr) {
  navigator.xr.ondevicechange = (event) => {
    // …
  };
}
```

Specifications
--------------

| Specification |
| --- |
| WebXR Device API # eventdef-xrsystem-devicechange |
| WebXR Device API # dom-xrsystem-ondevicechange |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
XRSystem: isSessionSupported() method
=====================================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

 The `XRSystem` method
 **`isSessionSupported()`** returns a promise which resolves to
 `true` if the specified WebXR session mode is supported by the user's WebXR
 device. Otherwise, the promise resolves with `false`.

 If no devices are available or the browser doesn't have permission
 to use the XR device, the promise is rejected with an appropriate
 `DOMException`.

Syntax
------


```js
isSessionSupported(mode)
```

### Parameters

`mode`

 A `String` specifying the WebXR session mode for which support is to
 be checked. Possible modes to check for:


* `immersive-ar` 
Experimental
* `immersive-vr`
* `inline`

### Return value

 A `Promise` that resolves to `true` if the specified session
 mode is supported; otherwise the promise resolves to `false`.

### Exceptions

 Rather than throwing true exceptions, `isSessionSupported()` rejects the
 returned promise, passing to the rejection handler a `DOMException` whose
 `name` is one of the following strings.

`SecurityError`

Use of this feature is blocked by an `xr-spatial-tracking` Permissions Policy.

Examples
--------

 In this example, we see `isSessionSupported()` used to detect whether or not
 the device supports VR mode by checking to see if an `immersive-vr` session
 is supported. If it is, we set up a button to read "Enter XR", to call a method
 `onButtonClicked()`, and enable the button.

 If no session is already underway, we request the VR session and, if successful, set up
 the session in a method called `onSessionStarted()`, not shown. If a session
 *is* already underway when the button is clicked, we call the
 `xrSession` object's `end()` method to shut
 down the WebXR session.


```js
if (navigator.xr) {
  navigator.xr.isSessionSupported("immersive-vr").then((isSupported) => {
    if (isSupported) {
      userButton.addEventListener("click", onButtonClicked);
      userButton.textContent = "Enter XR";
      userButton.disabled = false;
    }
  });
}

function onButtonClicked() {
  if (!xrSession) {
    navigator.xr.requestSession("immersive-vr").then((session) => {
      xrSession = session;
      // onSessionStarted() not shown for reasons of brevity and clarity.
      onSessionStarted(xrSession);
    });
  } else {
    // Button is a toggle button.
    xrSession.end();
  }
}
```

Specifications
--------------

| Specification |
| --- |
| WebXR Device API # dom-xrsystem-issessionsupported |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
XRWebGLDepthInformation: texture property
=========================================

**Experimental:** **This is an experimental technology**  
Check the Browser compatibility table carefully before using this in production.

The *read-only* **`texture`** property of the `XRWebGLDepthInformation` interface is a `WebGLTexture` containing depth buffer information as an opaque texture.

Value
-----

A `WebGLTexture`.

Examples
--------

Use `XRWebGLBinding.getDepthInformation()` to obtain GPU depth information. The returned `XRWebGLDepthInformation` object will contain the `texture` buffer which can then be bound to a texture and depth buffer information can be made available to a WebGL fragment shader.


```js
const depthInfo = glBinding.getDepthInformation(view);
const uvTransform = depthInfo.normDepthBufferFromNormView.matrix;

const u_DepthTextureLocation = gl.getUniformLocation(program, "u\_DepthTexture");
const u_UVTransformLocation = gl.getUniformLocation(program, "u\_UVTransform");
const u_RawValueToMeters = gl.getUniformLocation(program, "u\_RawValueToMeters");

gl.bindTexture(gl.TEXTURE\_2D, depthInfo.texture);
gl.activeTexture(gl.TEXTURE0);
gl.uniform1i(u_DepthTextureLocation, 0);

// UV transform to correctly index into the depth map
gl.uniformMatrix4fv(u_UVTransformLocation, false, uvTransform);

// scaling factor to convert from the raw number to meters
gl.uniform1f(u_RawValueToMeters, depthInfo.rawValueToMeters);
```

Specifications
--------------

| Specification |
| --- |
| WebXR Depth Sensing Module # dom-xrwebgldepthinformation-texture |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `XRWebGLBinding.getDepthInformation()`
* `WebGLRenderingContext.bindTexture()`
ByteLengthQueuingStrategy: highWaterMark property
=================================================

The read-only **`ByteLengthQueuingStrategy.highWaterMark`** property returns the total number of bytes that can be contained in the internal queue before backpressure is applied.

**Note:** Unlike `CountQueuingStrategy()` where the `highWaterMark` property specifies a simple count of the number of chunks, with `ByteLengthQueuingStrategy()`, the `highWaterMark` parameter specifies a number of *bytes* — specifically, given a stream of chunks, how many bytes worth of those chunks (rather than a count of how many of those chunks) can be contained in the internal queue before backpressure is applied.

Values
------

An integer.

Examples
--------


```js
const queuingStrategy = new ByteLengthQueuingStrategy({
  highWaterMark: 1 \* 1024,
});

const readableStream = new ReadableStream(
  {
    start(controller) {
      // …
    },
    pull(controller) {
      // …
    },
    cancel(err) {
      console.log("stream error:", err);
    },
  },
  queuingStrategy,
);

const size = queuingStrategy.size(chunk);
console.log(`highWaterMark value: ${queuingStrategy.highWaterMark}$`);
```

Specifications
--------------

| Specification |
| --- |
| Streams Standard # ref-for-blqs-high-water-mark① |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `ByteLengthQueuingStrategy()` constructor
ByteLengthQueuingStrategy: size() method
========================================

 The **`size()`** method of the
 `ByteLengthQueuingStrategy` interface returns the given chunk's
 `byteLength` property.

Syntax
------


```js
size(chunk)
```

### Parameters

`chunk`

A chunk of data being passed through the stream.

### Return value

An integer representing the byte length of the given chunk.

Examples
--------


```js
const queuingStrategy = new ByteLengthQueuingStrategy({ highWaterMark: 1 });

const readableStream = new ReadableStream(
  {
    start(controller) {
      // …
    },
    pull(controller) {
      // …
    },
    cancel(err) {
      console.log("stream error:", err);
    },
  },
  queuingStrategy,
);

const size = queueingStrategy.size(chunk);
```

Specifications
--------------

| Specification |
| --- |
| Streams Standard # blqs-size |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `ByteLengthQueuingStrategy()` constructor
ByteLengthQueuingStrategy: ByteLengthQueuingStrategy() constructor
==================================================================

 The **`ByteLengthQueuingStrategy()`**
 constructor creates and returns a `ByteLengthQueuingStrategy` object
 instance.

Syntax
------


```js
new ByteLengthQueuingStrategy(highWaterMark)
```

### Parameters

An object with the following property:

`highWaterMark`

The total number of bytes that can be contained in the internal queue before backpressure is applied.

Unlike `CountQueuingStrategy()` where the `highWaterMark` parameter specifies a simple count of the number of chunks, with `ByteLengthQueuingStrategy()`, the `highWaterMark` parameter specifies a number of *bytes* — specifically, given a stream of chunks, how many bytes worth of those chunks (rather than a count of how many of those chunks) can be contained in the internal queue before backpressure is applied.

### Return value

An instance of the `ByteLengthQueuingStrategy` object.

### Exceptions

None.

Examples
--------


```js
const queuingStrategy = new ByteLengthQueuingStrategy({
  highWaterMark: 1 \* 1024,
});

const readableStream = new ReadableStream(
  {
    start(controller) {
      // …
    },
    pull(controller) {
      // …
    },
    cancel(err) {
      console.log("stream error:", err);
    },
  },
  queuingStrategy,
);

const size = queuingStrategy.size(chunk);
```

Specifications
--------------

| Specification |
| --- |
| Streams Standard # blqs-constructor |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `ByteLengthQueuingStrategy` interface
RTCIceCandidatePairStats: availableOutgoingBitrate property
===========================================================

 The `RTCIceCandidatePairStats` property
 **`availableOutgoingBitrate`** returns a value indicative of
 the available outbound capacity of the network connection represented by the candidate
 pair. The higher the value, the more bandwidth you can assume is available for
 outgoing data.

 You can get the incoming available bitrate from
 `availableIncomingBitrate`.

Value
-----

 A floating-point value which approximates the amount of available bandwidth for
 outgoing data on the network connection described by the
 `RTCIceCandidatePair`. The value is reported in bits per second and is
 computed over a 1-second interval.

The returned value is `undefined` in each of the following situations:

* The underlying implementation doesn't support computing a sender-side estimate of
 the outgoing bit rate.
* The `RTCIceCandidatePair` described by this object has never been used.
* The candidate pair was once in use, but no longer is.

 The value returned is calculated by adding up the available bit rate for every
 RTP stream using the connection described by this candidate pair. The
 returned value doesn't take into account overhead introduced by underlying protocols,
 including IP, UDP, or TCP.


**Note:** The returned value is computed using a method similar—but not
 identical—to the Transport Independent Application Specific Maximum (TIAS) described
 in RFC 3890, section 6.2.


Specifications
--------------

| Specification |
| --- |
| Identifiers for WebRTC's Statistics API # dom-rtcicecandidatepairstats-availableoutgoingbitrate |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
RTCIceCandidatePairStats: selected property
===========================================

**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The *non-standard*, Firefox-specific `RTCIceCandidatePairStats` property **`selected`** indicates whether or not the candidate pair described by the object is the one currently being used to communicate with the remote peer.

Syntax
------


```js
icpStats.selected
```

### Value

A Firefox-specific Boolean value which is `true` if the candidate pair described by this object is the one currently in use.

In any other browser, you can determine the selected candidate pair by looking for a stats object of type `transport`, which is an `RTCTransportStats` object. That object's `selectedCandidatePairId` property indicates whether or not the specified transport is the one being used.

Example
-------

The function shown in this example identifies the currently-selected candidate pair from a statistics report by first iterating over each report, looking for a `transport` report; when one is found, that transport's `selectedCandidatePairId` is used to get the `RTCIceCandidatePair` describing the connection.

If that fails, then the second section iterates over the reports, looking for a `candidate-pair` record whose Firefox-specific `selected` property is `true`. This candidate pair is then returned as the currently-selected one.


```js
function getCurrentCandidatePair(statsResults) {
  statsResults.forEach((report) => {
    if (report.type === "transport") {
      currentPair = statsResults.get(report.selectedCandidatePairId);
    }
  });

  if (!currentPair) {
    statsResults.forEach((report) => {
      if (report.type === "candidate-pair" && report.selected) {
        currentPair = report;
      }
    });
  }

  return currentPair;
}
```

Specifications
--------------

Not part of any specification. This property is unique to Firefox.

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
RTCIceCandidatePairStats: currentRoundTripTime property
=======================================================

 The `RTCIceCandidatePairStats` property
 **`currentRoundTripTime`** is a floating-point value
 indicating the number of seconds it takes for data to be sent by this peer to the
 remote peer and back over the connection described by this pair of ICE
 candidates.

Syntax
------


```js
rtt = rtcIceCandidatePairStats.currentRoundTripTime
```

### Value

 A floating-point value indicating the round-trip time, in seconds for the connection
 described by the pair of candidates for which this `RTCIceCandidatePairStats`
 object offers statistics.

 This value is computed by observing the time that elapsed between the most recent
 STUN request being sent to the remote peer and the response to that
 request arriving. This information may come from ongoing STUN connectivity checks as
 well as from consent requests made when the connection was initially being opened.

Specifications
--------------

| Specification |
| --- |
| Identifiers for WebRTC's Statistics API # dom-rtcicecandidatepairstats-currentroundtriptime |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.
RTCIceCandidatePairStats: readable property
===========================================

**Deprecated:** This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

**Non-standard:** This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

 The *obsolete* `RTCIceCandidatePairStats`
 property **`readable`** reports whether or not the connection
 described by the candidate pair has received at least one valid incoming ICE
 request.

Value
-----

 A Boolean value which is `true` if the connection described by this
 candidate pair has received at least one valid ICE request, and is therefore ready to be
 read from.


**Note:** This property was removed from the specification in early 2017
 because you can determine whether or not the connection is readable by checking to see
 if `requestsReceived` is
 greater than 0:



```js
if (icpStats.requestsReceived > 0) {
  /\* at least one ICE request has been received \*/
}
```


Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.