From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/api/mediarecorder/pause/index.html | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 files/zh-cn/web/api/mediarecorder/pause/index.html (limited to 'files/zh-cn/web/api/mediarecorder/pause') 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 +--- +
{{APIRef("MediaStream Recording")}}
+ +

The Media.pause() method (part of the MediaRecorder API) is used to pause recording of media streams.

+ +

When a MediaRecorder object’s pause()method is called, the browser queues a task that runs the below steps:

+ +
    +
  1. If {{domxref("MediaRecorder.state")}} is "inactive", raise a DOM InvalidState error and terminate these steps. If not, continue to the next step.
  2. +
  3. Set {{domxref("MediaRecorder.state")}} to "paused".
  4. +
  5. Stop gathering data into the current {{domxref("Blob")}}, but keep it available so that recording can be resumed later on.
  6. +
  7. Raise a {{event("pause")}} event.
  8. +
+ +

Syntax

+ +
MediaRecorder.pause()
+ +

Return value

+ +

undefined.

+ +

Exceptions

+ +
+
InvalidStateError
+
The MediaRecorder is currently "inactive"; you can't pause recording if it's not active. If you call pause() while already paused, it silently does nothing.
+
+ +

Example

+ +
...
+
+ pause.onclick = function() {
+     mediaRecorder.pause();
+     console.log("recording paused");
+ }
+
+...
+ +

Specifications

+ + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName("MediaStream Recording", "#widl-MediaRecorder-pause-void", "MediaRecorder.pause()")}}{{Spec2("MediaStream Recording")}}Initial definition
+ +

Browser compatibility

+ + + +

{{Compat("api.MediaRecorder.pause")}}

+ +

See also

+ + -- cgit v1.2.3-54-g00ecf