diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/mediarecorder/pause | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/mediarecorder/pause')
-rw-r--r-- | files/zh-cn/web/api/mediarecorder/pause/index.html | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/mediarecorder/pause/index.html b/files/zh-cn/web/api/mediarecorder/pause/index.html new file mode 100644 index 0000000000..703d032d10 --- /dev/null +++ b/files/zh-cn/web/api/mediarecorder/pause/index.html @@ -0,0 +1,75 @@ +--- +title: MediaRecorder.pause() +slug: Web/API/MediaRecorder/pause +translation_of: Web/API/MediaRecorder/pause +--- +<div>{{APIRef("MediaStream Recording")}}</div> + +<p><span class="seoSummary">The <strong><code>Media.pause()</code></strong> method (part of the <a href="/en-US/docs/Web/API/MediaRecorder_API">MediaRecorder API</a>) is used to pause recording of media streams.</span></p> + +<p>When a <code>MediaRecorder</code> object’s <code>pause()</code>method is called, the browser queues a task that runs the below steps:</p> + +<ol> + <li>If {{domxref("MediaRecorder.state")}} is "inactive", raise a DOM <code>InvalidState</code> error and terminate these steps. If not, continue to the next step.</li> + <li>Set {{domxref("MediaRecorder.state")}} to "paused".</li> + <li>Stop gathering data into the current {{domxref("Blob")}}, but keep it available so that recording can be resumed later on.</li> + <li>Raise a {{event("pause")}} event.</li> +</ol> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox"><em>MediaRecorder</em>.pause()</pre> + +<h3 id="Return_value">Return value</h3> + +<p><code>undefined</code>.</p> + +<h3 id="Exceptions">Exceptions</h3> + +<dl> + <dt><code>InvalidStateError</code></dt> + <dd>The <code>MediaRecorder</code> is currently <code>"inactive"</code>; you can't pause recording if it's not active. If you call <code>pause()</code> while already paused, it silently does nothing.</dd> +</dl> + +<h2 id="Example">Example</h2> + +<pre class="brush: js">... + + pause.onclick = function() { + mediaRecorder.pause(); + console.log("recording paused"); + } + +...</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-pause-void", "MediaRecorder.pause()")}}</td> + <td>{{Spec2("MediaStream Recording")}}</td> + <td>Initial definition</td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.MediaRecorder.pause")}}</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> |