diff options
Diffstat (limited to 'files/ru/web/api/mediarecorder/requestdata')
-rw-r--r-- | files/ru/web/api/mediarecorder/requestdata/index.html | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/files/ru/web/api/mediarecorder/requestdata/index.html b/files/ru/web/api/mediarecorder/requestdata/index.html new file mode 100644 index 0000000000..07fb15a876 --- /dev/null +++ b/files/ru/web/api/mediarecorder/requestdata/index.html @@ -0,0 +1,123 @@ +--- +title: MediaRecorder.requestData() +slug: Web/API/MediaRecorder/requestData +translation_of: Web/API/MediaRecorder/requestData +--- +<p>{{APIRef("MediaStream Recording")}}</p> + +<p><span class="seoSummary">Метод <strong><code>MediaRecorder.requestData()</code></strong> (часть <a href="/en-US/docs/Web/API/MediaRecorder_API">MediaRecorder API</a>) используется, чтобы поднять {{domxref("dataavailable")}} событие содержащее {{domxref("Blob")}} объект захваченных медиа-данных как это было когда метод был вызван.</span> This can then be grabbed и маниулировать как необходимо.</p> + +<p>When the <code>requestData()</code> method is invoked, the browser queues a task that runs the following steps:</p> + +<ol> + <li>If {{domxref("MediaRecorder.state")}} is not "recording", raise a DOM <code>InvalidState</code> error and terminate these steps. If {{domxref("MediaRecorder.state")}} is "recording", continue to the next step.</li> + <li>Raise a {{domxref("dataavailable")}} event containing a {{domxref("Blob")}} of the currently captured data (the Blob is available under the event's <code>data</code> attribute.)</li> + <li>Create a new Blob and place subsequently captured data into it.</li> +</ol> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox">MediaRecorder.requestData()</pre> + +<h3 id="Errors">Errors</h3> + +<p>An <code>InvalidState</code> error is raised if the <code>requestData()</code> method is called while the <code>MediaRecorder</code> object’s {{domxref("MediaRecorder.state")}} is not "recording" — the media cannot be captured if recording is not occurring.</p> + +<h2 id="Example">Example</h2> + +<pre class="brush: js">... + + captureMedia.onclick = function() { + mediaRecorder.requestData(); + // makes snapshot available of data so far + // ondataavailable fires, then capturing continues + // in new Blob + } + +...</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-requestData-void", "MediaRecorder.requestData()")}}</td> + <td>{{Spec2("MediaStream Recording")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>{{CompatibilityTable}}</p> + +<div id="compat-desktop"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Chrome</th> + <th>Firefox (Gecko)</th> + <th>Internet Explorer</th> + <th>Opera</th> + <th>Safari (WebKit)</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatChrome(47)}}<sup>[2]</sup></td> + <td>{{CompatGeckoDesktop("25.0")}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<div id="compat-mobile"> +<table class="compat-table"> + <tbody> + <tr> + <th>Feature</th> + <th>Android</th> + <th>Android Webview</th> + <th>Firefox Mobile (Gecko)</th> + <th>Firefox OS</th> + <th>IE Phone</th> + <th>Opera Mobile</th> + <th>Safari Mobile</th> + <th>Chrome for Android</th> + </tr> + <tr> + <td>Basic support</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatGeckoDesktop("25.0")}}</td> + <td>1.3<sup>[1]</sup></td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + <td>{{CompatNo}}</td> + </tr> + </tbody> +</table> +</div> + +<p>[1] The intial Firefox OS implementation only supported audio recording.</p> + +<p>[2] To try this feature on Chrome, enable <em>Experimental Web Platform features</em> from <a>chrome://flags</a> . Currently only video is supported, not audio.</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/MediaRecorder_API/Using_the_MediaRecorder_API">Using the MediaRecorder API</a></li> + <li><a href="http://mdn.github.io/web-dictaphone/">Web Dictaphone</a>: MediaRecorder + getUserMedia + Web Audio API visualization demo, by <a href="https://twitter.com/chrisdavidmills">Chris Mills</a> (<a href="https://github.com/mdn/web-dictaphone/">source on Github</a>.)</li> + <li><a href="http://simpl.info/mediarecorder/">simpl.info MediaStream Recording demo</a>, by <a href="https://twitter.com/sw12">Sam Dutton</a>.</li> + <li>{{domxref("Navigator.getUserMedia")}}</li> +</ul> |