-
Notifications
You must be signed in to change notification settings - Fork 20
Update configuration change section #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -778,15 +778,23 @@ <h4>Processing considerations</h4> | |
<section> | ||
<h2>Exposing change of MediaStreamTrack configuration</h2> | ||
<div> | ||
<p>The configuration (capabilities, constraints or settings) of a {{MediaStreamTrack}} may be changed dynamically | ||
<p>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. | ||
</p> | ||
<pre class="idl"> | ||
</p> | ||
</div> | ||
<h3>MediaStreamTrack Interface Extensions</h3> | ||
<div> | ||
<pre class="idl"> | ||
partial interface MediaStreamTrack { | ||
attribute EventHandler onconfigurationchange; | ||
};</pre> | ||
<p>The <dfn data-dfn-for="MediaStreamTrack">onconfigurationchange</dfn> attribute | ||
is an [=event handler IDL attribute=] for the `onconfigurationchange` | ||
[=event handler=], whose [=event handler event type=] is | ||
<dfn event for=MediaStreamTrack>configurationchange</dfn>. | ||
</p> | ||
<p> | ||
<p>When the [=User Agent=] detects <dfn data-export id="change-track-configuration">a change of configuration</dfn> | ||
in a <var>track</var>'s underlying source, the [=User Agent=] MUST run the following steps:</p> | ||
|
@@ -804,12 +812,18 @@ <h2>Exposing change of MediaStreamTrack configuration</h2> | |
<ol> | ||
<li><p>If <var>track</var>.{{MediaStreamTrack/readyState}} is "ended", abort these steps.</p></li> | ||
<li><p>If <var>track</var>'s capabilities, constraints and settings are matching <var>source</var> configuration, abort these steps. | ||
<li><p>Let <var>changes</var> be an empty [=set=].</p></li> | ||
<li><p>[=map/For each=] <var>key</var>-<var>value</var> pair of <var>source</var>'s settings, if <var>track</var>'s settings does not have the same pair, [=set/append=] <var>key</var> to <var>changes</var>.</p></li> | ||
<li><p>[=map/For each=] <var>key</var>-<var>value</var> pair of <var>track</var>'s settings, if <var>source</var>'s settings does not have the same pair, [=set/append=] <var>key</var> to <var>changes</var>.</p></li> | ||
<li><p>[=map/For each=] <var>key</var>-<var>value</var> pair of <var>source</var>'s capabilities, if <var>track</var>'s capabilities does not have the same pair, [=set/append=] <var>key</var> to <var>changes</var>.</p></li> | ||
<li><p>[=map/For each=] <var>key</var>-<var>value</var> pair of <var>track</var>'s capabilities, if <var>source</var>'s capabilities does not have the same pair, [=set/append=] <var>key</var> to <var>changes</var>.</p></li> | ||
<li><p>If <var>changes</var> [=list/is empty=], abort these steps.</p></li> | ||
beaufortfrancois marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
<li> | ||
<!-- FIXME: Export capabilities, constraints and settings so that we can use them here. --> | ||
<p>Update <var>track</var>'s capabilities, constraints and settings according <var>track</var>'s underlying source.</p> | ||
<!-- FIXME: Export capabilities and settings so that we can use them here. --> | ||
<p>Update <var>track</var>'s capabilities and settings according <var>track</var>'s underlying source.</p> | ||
</li> | ||
<li> | ||
<p>[=Fire an event=] named <var>configurationchange</var> on <var>track</var>.</p> | ||
<p>[=Fire an event=] named {{configurationchange}} on <var>track</var>.</p> | ||
</li> | ||
</ol> | ||
</li> | ||
|
@@ -822,6 +836,19 @@ <h2>Exposing change of MediaStreamTrack configuration</h2> | |
</div> | ||
</p> | ||
</div> | ||
<h3>Example</h3> | ||
<div> | ||
<p>This example shows how to monitor external background blur changes.</p> | ||
<pre class="example"> | ||
const stream = await navigator.mediaDevices.getUserMedia({ video: true }); | ||
const [track] = stream.getVideoTracks(); | ||
track.addEventListener("configurationchange", (event) => { | ||
// Background blur configuration may have changed. | ||
if (track.getSettings().backgroundBlur) { | ||
// Turn off web app own blurring if needed so that video doesn't get double-blurred. | ||
} | ||
beaufortfrancois marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
});</pre> | ||
</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: It's weird to see the </pre> as less indented than the </div>. The following indentation seems preferrable imho:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 3e48bd2 |
||
</section> | ||
</body> | ||
</html> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.