aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/mediarecorder/start/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ru/web/api/mediarecorder/start/index.html')
-rw-r--r--files/ru/web/api/mediarecorder/start/index.html80
1 files changed, 80 insertions, 0 deletions
diff --git a/files/ru/web/api/mediarecorder/start/index.html b/files/ru/web/api/mediarecorder/start/index.html
new file mode 100644
index 0000000000..c86d17137e
--- /dev/null
+++ b/files/ru/web/api/mediarecorder/start/index.html
@@ -0,0 +1,80 @@
+---
+title: MediaRecorder.start()
+slug: Web/API/MediaRecorder/start
+translation_of: Web/API/MediaRecorder/start
+---
+<div>{{APIRef("Media Recorder API")}}</div>
+
+<p><span class="seoSummary">Метод <strong><code>MediaRecorder.start()</code></strong> (часть <a href="/en-US/docs/Web/API/MediaRecorder_API">MediaRecorder API</a>) используется для начала захвата медиа {{domxref("Blob")}}.</span></p>
+
+<p>When the <code>start()</code> method is invoked, the UA queues a task that runs the following steps:</p>
+
+<ol>
+ <li>If the {{domxref("MediaRecorder.state")}} is not "inactive", raise a DOM <code>InvalidState</code> error and terminate these steps. if the {{domxref("MediaRecorder.state")}} is "inactive", continue on to the next step.</li>
+ <li>Set the {{domxref("MediaRecorder.state")}} to "recording" and wait until media becomes available from the <code>stream</code> passed into {{domxref("Navigator.getUserMedia")}}.</li>
+ <li>Once data becomes available, raise a {{domxref("MediaRecorder.start")}} event and start gathering the data into a {{domxref("Blob")}} (see <cite><a class="bibref" href="https://dvcs.w3.org/hg/dap/raw-file/default/media-stream-capture/MediaRecorder.html#bib-FILE-API">FILE-API</a></cite>).</li>
+ <li>If the <code>timeSlice</code> argument has been provided, once that many milliseconds of data have been collected — or a minimum time slice imposed by the UA, whichever is greater — raise a {{domxref("MediaRecorder.dataavailable")}} event containing the Blob of collected data, and start gathering a new Blob of data. If <code>timeSlice</code> has not been provided, continue gathering data into the original Blob.</li>
+ <li>When the <code>stream</code> is ended, set {{domxref("MediaRecorder.state")}} to "inactive" and stop gathering data.</li>
+ <li>Raise a {{domxref("MediaRecorder.dataavailable")}} event containing the Blob of data.</li>
+ <li>Raise a {{domxref("MediaRecorder.stop")}} event.</li>
+</ol>
+
+<div class="note">
+<p><strong>Note</strong>: If the browser is unable to start recording or continue recording, it<em> will</em> raise a {{domxref("DOMError")}} event, followed by a {{domxref("MediaRecorder.dataavailable")}} event containing the Blob it has gathered, followed by the {{domxref("MediaRecorder.stop")}} event.</p>
+</div>
+
+<h2 id="Синтаксис">Синтаксис</h2>
+
+<pre class="syntaxbox">MediaRecorder.start(timeslice)</pre>
+
+<h3 id="Параметры">Параметры</h3>
+
+<dl>
+ <dt><code>timeslice</code> {{optional_inline}}</dt>
+ <dd>Этот параметр принимает значение в миллисекундах, и переопределяет длину куска захвата медиа для возвращения в каждом Blob. Если не указан, то все медиа данные будут занесены в один Blob, только если не был вызван метод {{domxref("MediaRecorder.requestData")}}.</dd>
+</dl>
+
+<h3 id="Ошибки">Ошибки</h3>
+
+<p>An <code>InvalidState</code> error is raised if the <code>start()</code> method is called while the <code>MediaRecorder</code> object’s {{domxref("MediaRecorder.state")}} is not "inactive" — it makes no sense to start media capture if it is already happening.</p>
+
+<h2 id="Пример">Пример</h2>
+
+<pre class="brush: js">...
+
+ record.onclick = function() {
+ mediaRecorder.start();
+ console.log("рекордер запущен");
+ }
+
+...</pre>
+
+<h2 id="Specifications">Specifications</h2>
+
+<table class="standard-table">
+ <tbody>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ <tr>
+ <td>{{SpecName("MediaStream Recording", "#widl-MediaRecorder-start-void-long-timeslice", "MediaRecorder.start()")}}</td>
+ <td>{{Spec2("MediaStream Recording")}}</td>
+ <td>Initial definition</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Совместимость_с_браузерами">Совместимость с браузерами</h2>
+
+<p>{{Compat("api.MediaRecorder.start")}}</p>
+
+<h2 id="Смотрите_также">Смотрите также</h2>
+
+<ul>
+ <li><a href="/ru/docs/Web/API/MediaRecorder_API/Using_the_MediaRecorder_API">Использование MediaRecorder API</a></li>
+ <li><a href="http://mdn.github.io/web-dictaphone/">Веб-диктофон</a>: MediaRecorder + getUserMedia + Web Audio API от <a href="https://twitter.com/chrisdavidmills">Chris Mills</a> (<a href="https://github.com/mdn/web-dictaphone/">исходники на Github</a>.)</li>
+ <li><a href="http://simpl.info/mediarecorder/">simpl.info Пример использования MediaStream</a> от <a href="https://twitter.com/sw12">Sam Dutton</a>.</li>
+ <li>{{domxref("Navigator.getUserMedia")}}</li>
+</ul>