Skip to content

Commit

Permalink
Define which track to use in MediaStreamAudioSourceNode more clearly.
Browse files Browse the repository at this point in the history
This fixes #1772.
  • Loading branch information
padenot committed Jan 16, 2019
1 parent 615bbec commit 8676d96
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions index.bs
Expand Up @@ -7869,17 +7869,7 @@ Attributes</h4>
The {{MediaStreamAudioSourceNode}} Interface</h3>

This interface represents an audio source from a
[[mediacapture-streams#mediastream|MediaStream]]. The track that will be used as the source
of audio and will be output from this node is the first
[[mediacapture-streams#mediastreamtrack|MediaStreamTrack]] whose <code>kind</code> attribute has
the value <code>"audio"</code>, when alphabetically sorting the
tracks of this [[mediacapture-streams#mediastream|MediaStream]] by their <code>id</code>
attribute. Those interfaces are described in
[[!mediacapture-streams]].

Note: The behaviour for picking the track to output is weird for legacy
reasons. {{MediaStreamTrackAudioSourceNode}} should be used
instead.
[[mediacapture-streams#mediastream|MediaStream]].

<pre class=include>
path: audionode-noinput.include
Expand All @@ -7888,9 +7878,9 @@ macros:
tail-time: No
</pre>

The number of channels of the output corresponds to the number of
channels of the [[mediacapture-streams#mediastreamtrack|MediaStreamTrack]]. If there is no valid
audio track, then the number of channels output will be one silent
The number of channels of the output corresponds to the number of channels of
the [[mediacapture-streams#mediastreamtrack|MediaStreamTrack]]. If there is no
valid audio track, then the number of channels output will be one silent
channel.

<pre class="idl">
Expand All @@ -7914,10 +7904,25 @@ Constructors</h4>
[[mediacapture-streams#mediastream|MediaStream]] that has at least one
[[mediacapture-streams#mediastreamtrack|MediaStramTrack]] whose
<code>kind</code> attribute has the value <code>"audio"</code>,
throw an {{InvalidStateError}} and abort these steps.
3. Let <var>node</var> be a new {{MediaStreamAudioSourceNode}}
throw an {{InvalidStateError}} and abort these steps. Else, let
this stream be <var>inputStream</var>.
3. Let <var>tracks</var> the list of all
[[mediacapture-streams#mediastreamtrack|MediaStreamTrack]] of
<var>inputStream</var> that have a <code>kind</code> of
<code>"audio"</code>.
4. Sort the elements in <var>tracks</var> based on their <code>id</code>
attribute, ordering by Unicode code point
5. Let the first element of <var>tracks</var> be the
[[mediacapture-streams#mediastreamtrack|MediaStreamTrack]] used as the
input audio for this {{MediaStreamAudioSourceNode}}.
6. Let <var>node</var> be a new {{MediaStreamAudioSourceNode}}
object. <a href="#audionode-constructor-init">Initialize</a>
<var>node</var>, and return <var>node</var>.

Note: The behaviour for picking the track to output is weird for legacy
reasons. {{MediaStreamTrackAudioSourceNode}} should be used
instead.

<pre class=argumentdef for="MediaStreamAudioSourceNode/MediaStreamAudioSourceNode()">
context: The {{AudioContext}} this new {{MediaStreamAudioSourceNode}} will be <a href="#associated">associated</a> with.
options: Initial parameter value for this {{MediaStreamAudioSourceNode}}.
Expand Down

0 comments on commit 8676d96

Please sign in to comment.