diff --git a/index.html b/index.html index 780cf00..4dfbbef 100644 --- a/index.html +++ b/index.html @@ -778,15 +778,23 @@
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. -
-+ +
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 @@If track.{{MediaStreamTrack/readyState}} is "ended", abort these steps.
If track's capabilities, constraints and settings are matching source configuration, abort these steps. +
If track's capabilities and settings are matching source configuration, abort these steps.
Update track's capabilities, constraints and settings according track's underlying source.
+ +Update track's capabilities and settings according track's underlying source.
[=Fire an event=] named configurationchange on track.
+[=Fire an event=] named {{configurationchange}} on track.
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); + } + }); ++