diff --git a/index.html b/index.html index 780cf00..4dfbbef 100644 --- a/index.html +++ b/index.html @@ -778,15 +778,23 @@

Processing considerations

Exposing change of MediaStreamTrack configuration

-

The configuration (capabilities, constraints or settings) of a {{MediaStreamTrack}} may be changed dynamically +

The configuration (capabilities and settings) of a {{MediaStreamTrack}} may be changed dynamically outside the control of web applications. One example is when a user decides to switch on background blur through the operating system. Web applications might want to know that the configuration of a particular {{MediaStreamTrack}} has changed. For that purpose, a new event is defined below. -

-
+      

+
+

MediaStreamTrack Interface Extensions

+
+
 partial interface MediaStreamTrack {
   attribute EventHandler onconfigurationchange;
 };
+

The onconfigurationchange attribute + is an [=event handler IDL attribute=] for the `onconfigurationchange` + [=event handler=], whose [=event handler event type=] is + configurationchange. +

When the [=User Agent=] detects a change of configuration in a track's underlying source, the [=User Agent=] MUST run the following steps:

@@ -803,13 +811,13 @@

Exposing change of MediaStreamTrack configuration

  1. If track.{{MediaStreamTrack/readyState}} is "ended", abort these steps.

  2. -
  3. If track's capabilities, constraints and settings are matching source configuration, abort these steps. +

  4. If track's capabilities and settings are matching source configuration, abort these steps.

  5. - -

    Update track's capabilities, constraints and settings according track's underlying source.

    + +

    Update track's capabilities and settings according track's underlying source.

  6. -

    [=Fire an event=] named configurationchange on track.

    +

    [=Fire an event=] named {{configurationchange}} on track.

@@ -822,6 +830,23 @@

Exposing change of MediaStreamTrack configuration

+

Example

+
+

This example shows how to monitor external background blur changes.

+
+      const stream = await navigator.mediaDevices.getUserMedia({video: true});
+      const [track] = stream.getVideoTracks();
+      let {backgroundBlur} = track.getSettings();
+      applyBlurInSoftwareInstead(!backgroundBlur);
+
+      track.addEventListener("configurationchange", () => {
+        if (backgroundBlur != track.getSettings().backgroundBlur) {
+          backgroundBlur = track.getSettings().backgroundBlur;
+          applyBlurInSoftwareInstead(!backgroundBlur);
+        }
+      });
+    
+