Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 27 additions & 16 deletions MediaRecorder.bs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ interface MediaRecorder : EventTarget {
<td class="prmNullFalse"><span role="img" aria-label="False">&#10008;</span></td>
<td class="prmOptTrue"><span role="img" aria-label="True">&#10004;</span></td>
<td class="prmDesc">The minimum number of milliseconds of data
to return in a single Blob.</td>
to return in a single {{Blob}}.</td>
</tr>
</tbody>
</table>
Expand All @@ -302,7 +302,7 @@ interface MediaRecorder : EventTarget {
task, using the DOM manipulation task source, that runs the following steps:
<ol>
<li>Set {{state}} to {{inactive}} and stop gathering data.</li>
<li>Let <var>blob</var> be the Blob of collected data so far and
<li>Let <var>blob</var> be the {{Blob}} of collected data so far and
let <var>target</var> be the MediaRecorder context object, then
<a href="#to-fire-a-blob-event">fire a blob event</a> named
<a>dataavailable</a> at <var>target</var> with <var>blob</var>.</li>
Expand Down Expand Up @@ -369,7 +369,7 @@ interface MediaRecorder : EventTarget {
(Note that <var>blob</var> will be empty if no data has been gathered
yet.)</li>

<li>Create a new Blob and gather subsequent data into it.</li>
<li>Create a new {{Blob}} and gather subsequent data into it.</li>
</ol>
</li>
<li>return <code>undefined</code>.</li>
Expand Down Expand Up @@ -569,19 +569,30 @@ dictionary BlobEventInit {
# Error handling # {#error-handling}

## General principles ## {#error-handling-principles}
<em>This section is non-normative.</em>

The UA will throw a {{DOMException}} when the error can be detected at the time
that the call is made. In all other cases the UA will <a>fire an event</a> named
{{MediaRecorderErrorEvent}}. If recording has been started and not yet stopped
when the error occurs, let <var>blob</var> be the {{Blob}} of collected data so
far; after raising the error, the UA will <a href="#to-fire-a-blob-event">fire a
dataavailable event</a> with <var>blob</var>; immediately after the UA will then
<a>fire an event</a> named <code>stop</code>.
The UA may set platform-specific limits, such as those for the minimum and
maximum {{Blob}} size that it will support, or the number of
{{MediaStreamTrack}}s it will record at once.
It will signal a fatal error if these limits are exceeded.

If at any moment the UA finds an error condition, the UA MUST queue a task,
using the DOM manipulation task source, that runs the following steps:
Copy link
Member

Choose a reason for hiding this comment

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

I worry this is a bit broad.

But more importantly, it looks like we already have normative steps for this as mentioned above, so with this PR there would be two competing normative steps for this condition, which I think is confusing (do we fire twice?) - I'd vote we fix the existing place instead and leave General Principles non-normative or remove it, it seems a bit redundant.

<ol>
<li>Set {{state}} to {{inactive}} and stop gathering data.</li>

<li>Let <var>blob</var> be the {{Blob}} of collected data so far and
let <var>target</var> be the MediaRecorder context object</li>

<li><a href="#to-fire-a-blob-event">Fire a blob event</a> named
<a>dataavailable</a> at <var>target</var> with <var>blob</var>.</li>

<li><a>Fire an event</a> named <a>stop</a> at <var>target</var></li>

<li><a>Fire an error event</a> named <var>event</var> at
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't it be "error"? Apart from the name, the italics would also cause me to go looking for a variable named event which has a string value.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ooops, my bad, I mean named {{UnknownError}}, next PS coming.

<var>target</var>.</li>
</ol>

<div class="note">
The UA MAY set platform-specific limits, e.g. for the minimum and maximum
{{Blob}} size that it will support, or the number of {{MediaStreamTrack}}s it
will record at once. It will signal a fatal error if these limits are
exceeded.
</div>

## MediaRecorderErrorEvent ## {#errorevent-section}

Expand Down
52 changes: 30 additions & 22 deletions MediaRecorder.html
Original file line number Diff line number Diff line change
Expand Up @@ -1183,7 +1183,7 @@
background-attachment: fixed;
}
</style>
<meta content="Bikeshed version 862f905dcd28738c926b57b7cfebee04d3d6e31e" name="generator">
<meta content="Bikeshed version 108b329dea0b65829ab3050d2b667fd8aa4dc7c1" name="generator">
<style>
table {
border-collapse: collapse;
Expand Down Expand Up @@ -1447,7 +1447,7 @@
<div class="head">
<p data-fill-with="logo"><a class="logo" href="http://www.w3.org/"> <img alt="W3C" height="48" src="https://www.w3.org/StyleSheets/TR/2016/logos/W3C" width="72"> </a> </p>
<h1 class="p-name no-ref" id="title">MediaStream Recording</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="2017-02-10">10 February 2017</time></span></h2>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Editor’s Draft, <time class="dt-updated" datetime="2017-02-15">15 February 2017</time></span></h2>
<div data-fill-with="spec-metadata">
<dl>
<dt>This version:
Expand Down Expand Up @@ -1758,7 +1758,7 @@ <h3 class="heading settled" data-level="2.3" id="mediarecorder-methods"><span cl
<td class="prmNullFalse"><span aria-label="False" role="img">✘</span>
<td class="prmOptTrue"><span aria-label="True" role="img">✔</span>
<td class="prmDesc">The minimum number of milliseconds of data
to return in a single Blob.
to return in a single <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/FileAPI/#dfn-Blob">Blob</a></code>.
</table>
<dt><dfn class="dfn-paneled idl-code" data-dfn-for="MediaRecorder" data-dfn-type="method" data-export="" id="dom-mediarecorder-stop"><code>stop()</code></dfn>
<dd>
Expand All @@ -1770,7 +1770,7 @@ <h3 class="heading settled" data-level="2.3" id="mediarecorder-methods"><span cl
task, using the DOM manipulation task source, that runs the following steps:
<ol>
<li>Set <code class="idl"><a data-link-type="idl" href="#dom-mediarecorder-state" id="ref-for-dom-mediarecorder-state-8">state</a></code> to <code class="idl"><a data-link-type="idl" href="#dom-recordingstate-inactive" id="ref-for-dom-recordingstate-inactive-7">inactive</a></code> and stop gathering data.
<li>Let <var>blob</var> be the Blob of collected data so far and
<li>Let <var>blob</var> be the <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/FileAPI/#dfn-Blob">Blob</a></code> of collected data so far and
let <var>target</var> be the MediaRecorder context object, then <a href="#to-fire-a-blob-event" id="ref-for-to-fire-a-blob-event-5">fire a blob event</a> named <a data-link-type="dfn" href="#dataavailable" id="ref-for-dataavailable-6">dataavailable</a> at <var>target</var> with <var>blob</var>.
<li><a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">Fire an event</a> named <a data-link-type="dfn" href="#stop" id="ref-for-stop-5">stop</a> at <var>target</var>.
</ol>
Expand Down Expand Up @@ -1821,7 +1821,7 @@ <h3 class="heading settled" data-level="2.3" id="mediarecorder-methods"><span cl
let <var>target</var> be the <code class="idl"><a data-link-type="idl" href="#mediarecorder" id="ref-for-mediarecorder-11">MediaRecorder</a></code> context object, then <a href="#to-fire-a-blob-event" id="ref-for-to-fire-a-blob-event-6">fire a blob event</a> named <a data-link-type="dfn" href="#dataavailable" id="ref-for-dataavailable-7">dataavailable</a> at <var>target</var> with <var>blob</var>.
(Note that <var>blob</var> will be empty if no data has been gathered
yet.)
<li>Create a new Blob and gather subsequent data into it.
<li>Create a new <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/FileAPI/#dfn-Blob">Blob</a></code> and gather subsequent data into it.
</ol>
<li>return <code>undefined</code>.
</ol>
Expand Down Expand Up @@ -1961,22 +1961,26 @@ <h4 class="heading settled" data-level="3.3.1" id="blobeventinit-members"><span
</dl>
<h2 class="heading settled" data-level="4" id="error-handling"><span class="secno">4. </span><span class="content">Error handling</span><a class="self-link" href="#error-handling"></a></h2>
<h3 class="heading settled" data-level="4.1" id="error-handling-principles"><span class="secno">4.1. </span><span class="content">General principles</span><a class="self-link" href="#error-handling-principles"></a></h3>
<em>This section is non-normative.</em>
<p>The UA will throw a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#dfn-DOMException">DOMException</a></code> when the error can be detected at the time
that the call is made. In all other cases the UA will <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <code class="idl"><a data-link-type="idl" href="#mediarecordererrorevent" id="ref-for-mediarecordererrorevent-2">MediaRecorderErrorEvent</a></code>. If recording has been started and not yet stopped
when the error occurs, let <var>blob</var> be the <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/FileAPI/#dfn-Blob">Blob</a></code> of collected data so
far; after raising the error, the UA will <a href="#to-fire-a-blob-event" id="ref-for-to-fire-a-blob-event-7">fire a
dataavailable event</a> with <var>blob</var>; immediately after the UA will then <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <code>stop</code>.
The UA may set platform-specific limits, such as those for the minimum and
maximum <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/FileAPI/#dfn-Blob">Blob</a></code> size that it will support, or the number of <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/mediacapture-streams/#mediastreamtrack">MediaStreamTrack</a></code>s it will record at once.
It will signal a fatal error if these limits are exceeded.</p>
<p>If at any moment the UA finds an error condition, the UA MUST queue a task,
using the DOM manipulation task source, that runs the following steps:</p>
<ol>
<li>Set <code class="idl"><a data-link-type="idl" href="#dom-mediarecorder-state" id="ref-for-dom-mediarecorder-state-15">state</a></code> to <code class="idl"><a data-link-type="idl" href="#dom-recordingstate-inactive" id="ref-for-dom-recordingstate-inactive-12">inactive</a></code> and stop gathering data.
<li>Let <var>blob</var> be the <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/FileAPI/#dfn-Blob">Blob</a></code> of collected data so far and
let <var>target</var> be the MediaRecorder context object
<li><a href="#to-fire-a-blob-event" id="ref-for-to-fire-a-blob-event-7">Fire a blob event</a> named <a data-link-type="dfn" href="#dataavailable" id="ref-for-dataavailable-8">dataavailable</a> at <var>target</var> with <var>blob</var>.
<li><a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">Fire an event</a> named <a data-link-type="dfn" href="#stop" id="ref-for-stop-6">stop</a> at <var>target</var>
<li><a data-link-type="dfn" href="#fire-an-error-event" id="ref-for-fire-an-error-event-3">Fire an error event</a> named <var>event</var> at <var>target</var>.
</ol>
<div class="note" role="note"> The UA MAY set platform-specific limits, e.g. for the minimum and maximum <code class="idl"><a data-link-type="idl" href="https://w3c.github.io/FileAPI/#dfn-Blob">Blob</a></code> size that it will support, or the number of <code class="idl"><a data-link-type="idl" href="https://www.w3.org/TR/mediacapture-streams/#mediastreamtrack">MediaStreamTrack</a></code>s it
will record at once. It will signal a fatal error if these limits are
exceeded. </div>
<h3 class="heading settled" data-level="4.2" id="errorevent-section"><span class="secno">4.2. </span><span class="content">MediaRecorderErrorEvent</span><a class="self-link" href="#errorevent-section"></a></h3>
<p>The <code class="idl"><a data-link-type="idl" href="#mediarecordererrorevent" id="ref-for-mediarecordererrorevent-3">MediaRecorderErrorEvent</a></code> interface is defined for cases when an event is
<p>The <code class="idl"><a data-link-type="idl" href="#mediarecordererrorevent" id="ref-for-mediarecordererrorevent-2">MediaRecorderErrorEvent</a></code> interface is defined for cases when an event is
raised that was caused by an error.</p>
<p><dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="fire an error event" data-noexport="" id="fire-an-error-event">To fire an error event</dfn> named <var>e</var> with a <code class="idl"><a data-link-type="idl" href="https://heycam.github.io/webidl/#dfn-DOMException">DOMException</a></code> named <var>error</var> means that an
event with the name <var>e</var>, which does not bubble (except where otherwise
stated) and is not cancelable (except where otherwise stated), and which uses
the <code class="idl"><a data-link-type="idl" href="#mediarecordererrorevent" id="ref-for-mediarecordererrorevent-4">MediaRecorderErrorEvent</a></code> interface with the <code class="idl"><a data-link-type="idl" href="#dom-mediarecordererrorevent-error" id="ref-for-dom-mediarecordererrorevent-error-1">error</a></code> attribute set to <var>error</var>, must be
the <code class="idl"><a data-link-type="idl" href="#mediarecordererrorevent" id="ref-for-mediarecordererrorevent-3">MediaRecorderErrorEvent</a></code> interface with the <code class="idl"><a data-link-type="idl" href="#dom-mediarecordererrorevent-error" id="ref-for-dom-mediarecordererrorevent-error-1">error</a></code> attribute set to <var>error</var>, must be
created and <a href="https://dom.spec.whatwg.org/#concept-event-dispatch">dispatched</a> at
the given target.</p>
<p></p>
Expand All @@ -1993,7 +1997,7 @@ <h4 class="heading settled" data-level="4.2.1" id="errorevent-constructor"><span
<dl class="domintro">
<dt><dfn class="dfn-paneled idl-code" data-dfn-for="MediaRecorderErrorEvent" data-dfn-type="constructor" data-export="" data-lt="MediaRecorderErrorEvent(type, eventInitDict)" id="dom-mediarecordererrorevent-mediarecordererrorevent"><code>MediaRecorderErrorEvent(DOMString type, MediaRecorderErrorEventInit eventInitDict)</code></dfn>
<dd>
Constructs a new <code class="idl"><a data-link-type="idl" href="#mediarecordererrorevent" id="ref-for-mediarecordererrorevent-5">MediaRecorderErrorEvent</a></code>.
Constructs a new <code class="idl"><a data-link-type="idl" href="#mediarecordererrorevent" id="ref-for-mediarecordererrorevent-4">MediaRecorderErrorEvent</a></code>.
<table class="parameters">
<tbody>
<tr>
Expand Down Expand Up @@ -2089,7 +2093,7 @@ <h2 class="heading settled" data-level="5" id="event-summary"><span class="secno
<td>The UA has resumed recording data from the MediaStream.
<tr>
<td><dfn data-dfn-type="dfn" data-noexport="" id="error">error<a class="self-link" href="#error"></a></dfn>
<td><code class="idl"><a data-link-type="idl" href="#mediarecordererrorevent" id="ref-for-mediarecordererrorevent-6">MediaRecorderErrorEvent</a></code>
<td><code class="idl"><a data-link-type="idl" href="#mediarecordererrorevent" id="ref-for-mediarecordererrorevent-5">MediaRecorderErrorEvent</a></code>
<td>An error has occurred, e.g. out of memory or a modification to
the <code class="idl"><a data-link-type="idl" href="#dom-mediarecorder-stream" id="ref-for-dom-mediarecorder-stream-7">stream</a></code> has occurred that makes it impossible to
continue recording (e.g. a Track has been added to or removed from
Expand Down Expand Up @@ -2446,6 +2450,7 @@ <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">I
<li><a href="#ref-for-dom-mediarecorder-state-1">2. Media Recorder API</a>
<li><a href="#ref-for-dom-mediarecorder-state-2">2.3. Methods</a> <a href="#ref-for-dom-mediarecorder-state-3">(2)</a> <a href="#ref-for-dom-mediarecorder-state-4">(3)</a> <a href="#ref-for-dom-mediarecorder-state-5">(4)</a> <a href="#ref-for-dom-mediarecorder-state-6">(5)</a> <a href="#ref-for-dom-mediarecorder-state-7">(6)</a> <a href="#ref-for-dom-mediarecorder-state-8">(7)</a> <a href="#ref-for-dom-mediarecorder-state-9">(8)</a> <a href="#ref-for-dom-mediarecorder-state-10">(9)</a> <a href="#ref-for-dom-mediarecorder-state-11">(10)</a> <a href="#ref-for-dom-mediarecorder-state-12">(11)</a> <a href="#ref-for-dom-mediarecorder-state-13">(12)</a>
<li><a href="#ref-for-dom-mediarecorder-state-14">2.4. Data handling</a>
<li><a href="#ref-for-dom-mediarecorder-state-15">4.1. General principles</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="dom-mediarecorder-onstart">
Expand Down Expand Up @@ -2599,6 +2604,7 @@ <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">I
<li><a href="#ref-for-dom-recordingstate-inactive-1">2.2. Attributes</a>
<li><a href="#ref-for-dom-recordingstate-inactive-2">2.3. Methods</a> <a href="#ref-for-dom-recordingstate-inactive-3">(2)</a> <a href="#ref-for-dom-recordingstate-inactive-4">(3)</a> <a href="#ref-for-dom-recordingstate-inactive-5">(4)</a> <a href="#ref-for-dom-recordingstate-inactive-6">(5)</a> <a href="#ref-for-dom-recordingstate-inactive-7">(6)</a> <a href="#ref-for-dom-recordingstate-inactive-8">(7)</a> <a href="#ref-for-dom-recordingstate-inactive-9">(8)</a> <a href="#ref-for-dom-recordingstate-inactive-10">(9)</a>
<li><a href="#ref-for-dom-recordingstate-inactive-11">2.6. RecordingState</a>
<li><a href="#ref-for-dom-recordingstate-inactive-12">4.1. General principles</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="dom-recordingstate-recording">
Expand Down Expand Up @@ -2670,6 +2676,7 @@ <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">I
<b><a href="#fire-an-error-event">#fire-an-error-event</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-fire-an-error-event-1">2.3. Methods</a> <a href="#ref-for-fire-an-error-event-2">(2)</a>
<li><a href="#ref-for-fire-an-error-event-3">4.1. General principles</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="dictdef-mediarecordererroreventinit">
Expand All @@ -2683,10 +2690,9 @@ <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">I
<b><a href="#mediarecordererrorevent">#mediarecordererrorevent</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-mediarecordererrorevent-1">2.2. Attributes</a>
<li><a href="#ref-for-mediarecordererrorevent-2">4.1. General principles</a>
<li><a href="#ref-for-mediarecordererrorevent-3">4.2. MediaRecorderErrorEvent</a> <a href="#ref-for-mediarecordererrorevent-4">(2)</a>
<li><a href="#ref-for-mediarecordererrorevent-5">4.2.1. Constructors</a>
<li><a href="#ref-for-mediarecordererrorevent-6">5. Event summary</a>
<li><a href="#ref-for-mediarecordererrorevent-2">4.2. MediaRecorderErrorEvent</a> <a href="#ref-for-mediarecordererrorevent-3">(2)</a>
<li><a href="#ref-for-mediarecordererrorevent-4">4.2.1. Constructors</a>
<li><a href="#ref-for-mediarecordererrorevent-5">5. Event summary</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="dom-mediarecordererrorevent-mediarecordererrorevent">
Expand Down Expand Up @@ -2719,13 +2725,15 @@ <h2 class="no-num no-ref heading settled" id="idl-index"><span class="content">I
<ul>
<li><a href="#ref-for-stop-1">2.2. Attributes</a>
<li><a href="#ref-for-stop-2">2.3. Methods</a> <a href="#ref-for-stop-3">(2)</a> <a href="#ref-for-stop-4">(3)</a> <a href="#ref-for-stop-5">(4)</a>
<li><a href="#ref-for-stop-6">4.1. General principles</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="dataavailable">
<b><a href="#dataavailable">#dataavailable</a></b><b>Referenced in:</b>
<ul>
<li><a href="#ref-for-dataavailable-1">2.2. Attributes</a>
<li><a href="#ref-for-dataavailable-2">2.3. Methods</a> <a href="#ref-for-dataavailable-3">(2)</a> <a href="#ref-for-dataavailable-4">(3)</a> <a href="#ref-for-dataavailable-5">(4)</a> <a href="#ref-for-dataavailable-6">(5)</a> <a href="#ref-for-dataavailable-7">(6)</a>
<li><a href="#ref-for-dataavailable-8">4.1. General principles</a>
</ul>
</aside>
<aside class="dfn-panel" data-for="pause">
Expand Down