Skip to content
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

Add audioConstantBitRate flag to MediaRecorderOptions. #185

Merged
merged 7 commits into from Feb 4, 2020
55 changes: 55 additions & 0 deletions MediaRecorder.bs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ interface MediaRecorder : EventTarget {
attribute EventHandler onerror;
readonly attribute unsigned long videoBitsPerSecond;
readonly attribute unsigned long audioBitsPerSecond;
readonly attribute BitrateMode videoBitrateMode;
readonly attribute BitrateMode audioBitrateMode;

void start(optional unsigned long timeslice);
void stop();
Expand Down Expand Up @@ -154,6 +156,18 @@ interface MediaRecorder : EventTarget {
for the respective media types, such that the sum of {{videoBitsPerSecond}}
and {{audioBitsPerSecond}} is close to the value of |recorder|'s
[=[[ConstrainedBitsPerSecond]]=] slot.</li>
<li>If |recorder| supports the {{BitrateMode}} specified by the value of
|options|' {{MediaRecorderOptions/videoBitrateMode}} member,
then initialize |recorder|'s {{videoBitrateMode}} attribute to the value of
|options|' {{MediaRecorderOptions/videoBitrateMode}} member,
else initialize |recorder|'s {{videoBitrateMode}} attribute to the value
"vbr".</li>
<li>If |recorder| supports the {{BitrateMode}} specified by the value of
|options|' {{MediaRecorderOptions/audioBitrateMode}} member,
then initialize |recorder|'s {{audioBitrateMode}} attribute to the value of
|options|' {{MediaRecorderOptions/audioBitrateMode}} member,
else initialize |recorder|'s {{audioBitrateMode}} attribute to the value
"vbr".</li>
<li>Return |recorder|.</li>
</ol></dd>
</dl>
Expand Down Expand Up @@ -205,6 +219,12 @@ interface MediaRecorder : EventTarget {

<dt><dfn attribute for="MediaRecorder"><code>audioBitsPerSecond</code></dfn></dt>
<dd>The target bitrate used to encode audio tracks.</dd>

<dt><dfn attribute for="MediaRecorder"><code>videoBitrateMode</code></dfn></dt>
<dd>The {{BitrateMode}} used to encode video tracks.</dd>

<dt><dfn attribute for="MediaRecorder"><code>audioBitrateMode</code></dfn></dt>
<dd>The {{BitrateMode}} used to encode audio tracks.</dd>
</dl>

## Methods ## {#mediarecorder-methods}
Expand Down Expand Up @@ -283,6 +303,14 @@ interface MediaRecorder : EventTarget {
the value might be surpassed, not achieved, or only be achieved over a long
period of time.</li>

<li>Constrain the configuration of |recorder| to encode using the
{{BitrateMode}} specified by the value of |recorder|'s {{videoBitrateMode}}
attribute for all video tracks |recorder| will be recording.</li>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make sense for video?


<li>Constrain the configuration of |recorder| to encode using the
{{BitrateMode}} specified by the value of |recorder|'s {{audioBitrateMode}}
attribute for all audio tracks |recorder| will be recording.</li>
jan-ivar marked this conversation as resolved.
Show resolved Hide resolved

<li>Set |recorder|'s {{state}} to {{recording}}, and run the following steps
in parallel:
<ol>
Expand Down Expand Up @@ -580,6 +608,8 @@ dictionary MediaRecorderOptions {
unsigned long audioBitsPerSecond;
unsigned long videoBitsPerSecond;
unsigned long bitsPerSecond;
BitrateMode audioBitrateMode = "vbr";
BitrateMode videoBitrateMode = "vbr";
};
</pre>

Expand Down Expand Up @@ -610,8 +640,33 @@ dictionary MediaRecorderOptions {
{{MediaRecorderOptions/audioBitsPerSecond}} or
{{MediaRecorderOptions/videoBitsPerSecond}} if present, and might be
distributed among the present track encoders as the UA sees fit.</dd>

<dt><dfn dict-member for="MediaRecorderOptions"><code>audioBitrateMode</code></dfn></dt>
<dd>Specifes the {{BitrateMode}} that should be used to encode the Audio track(s).</dd>
jan-ivar marked this conversation as resolved.
Show resolved Hide resolved

<dt><dfn dict-member for="MediaRecorderOptions"><code>videoBitrateMode</code></dfn></dt>
<dd>Specifes the {{BitrateMode}} that should be used to encode the Video track(s).</dd>
</dl>

## BitrateMode ## {#bitratemode}

<pre class="idl">
enum BitrateMode {
"cbr",
"vbr"
};
</pre>

### Values ### {#bitratemode-values}

<dl class="domintro">
<dt><dfn enum-value for="BitrateMode"><code>cbr</code></dfn></dt>
<dd>Encode at a constant bitrate.</dd>

<dt><dfn enum-value for="BitrateMode"><code>vbr</code></dfn></dt>
<dd>Encode using a variable bitrate, allowing more space to be used for complex signals
and less space for less complex signals.</dd>
</dl>

## RecordingState ## {#recordingstate}

Expand Down