From 2a0848dfc98c2f04fe5c72a627e2b3be281fc3df Mon Sep 17 00:00:00 2001 From: MDN Date: Wed, 16 Mar 2022 00:12:44 +0000 Subject: [CRON] sync translated content --- files/zh-cn/_redirects.txt | 1 + files/zh-cn/_wikihistory.json | 14 ++-- .../mediarecorder/dataavailable_event/index.html | 81 ++++++++++++++++++++++ .../api/mediarecorder/ondataavailable/index.html | 80 --------------------- 4 files changed, 89 insertions(+), 87 deletions(-) create mode 100644 files/zh-cn/web/api/mediarecorder/dataavailable_event/index.html delete mode 100644 files/zh-cn/web/api/mediarecorder/ondataavailable/index.html (limited to 'files/zh-cn') diff --git a/files/zh-cn/_redirects.txt b/files/zh-cn/_redirects.txt index 73596ab89d..3b9ee0afb5 100644 --- a/files/zh-cn/_redirects.txt +++ b/files/zh-cn/_redirects.txt @@ -1416,6 +1416,7 @@ /zh-CN/docs/Web/API/Location.replace /zh-CN/docs/Web/API/Location/replace /zh-CN/docs/Web/API/MediaCapabilitiesInfo /zh-CN/docs/Web/API/MediaCapabilities/encodingInfo /zh-CN/docs/Web/API/MediaDevices/ondevicechange /zh-CN/docs/conflicting/Web/API/MediaDevices/devicechange_event +/zh-CN/docs/Web/API/MediaRecorder/ondataavailable /zh-CN/docs/Web/API/MediaRecorder/dataavailable_event /zh-CN/docs/Web/API/MediaStream.addTrack /zh-CN/docs/Web/API/MediaStream/addTrack /zh-CN/docs/Web/API/MouseEvent/which /zh-CN/docs/conflicting/Web/API/UIEvent/which /zh-CN/docs/Web/API/MouseWheelEvent /zh-CN/docs/conflicting/Web/API/WheelEvent diff --git a/files/zh-cn/_wikihistory.json b/files/zh-cn/_wikihistory.json index 3fd874797f..4dcfa7ff44 100644 --- a/files/zh-cn/_wikihistory.json +++ b/files/zh-cn/_wikihistory.json @@ -16683,6 +16683,13 @@ "forgamer" ] }, + "Web/API/MediaRecorder/dataavailable_event": { + "modified": "2020-10-15T22:28:21.731Z", + "contributors": [ + "BMud", + "baixiaocun" + ] + }, "Web/API/MediaRecorder/isTypeSupported": { "modified": "2019-06-06T05:26:50.779Z", "contributors": [ @@ -16691,13 +16698,6 @@ "wakingking77" ] }, - "Web/API/MediaRecorder/ondataavailable": { - "modified": "2020-10-15T22:28:21.731Z", - "contributors": [ - "BMud", - "baixiaocun" - ] - }, "Web/API/MediaRecorder/pause": { "modified": "2020-10-15T22:22:08.111Z", "contributors": [ diff --git a/files/zh-cn/web/api/mediarecorder/dataavailable_event/index.html b/files/zh-cn/web/api/mediarecorder/dataavailable_event/index.html new file mode 100644 index 0000000000..4daaf213e8 --- /dev/null +++ b/files/zh-cn/web/api/mediarecorder/dataavailable_event/index.html @@ -0,0 +1,81 @@ +--- +title: MediaRecorder.ondataavailable +slug: Web/API/MediaRecorder/dataavailable_event +translation_of: Web/API/MediaRecorder/ondataavailable +original_slug: Web/API/MediaRecorder/ondataavailable +--- +

{{APIRef("MediaStream Recording")}}

+ +

MediaRecorder.ondataavailable 事件处理程序(part of the MediaStream记录API)处理{{event("dataavailable")}}事件,让您在响应运行代码{{domxref("Blob")}}数据被提供使用。

+ +

dataavailable当MediaRecorder将媒体数据传递到您的应用程序以供使用时,将触发事件。数据在包含数据的{{domxref("Blob")}}对象中提供。这在四种情况下发生:

+ + + +
+

包含媒体数据的{{domxref("Blob")}}在{{event("dataavailable")}}事件的data属性中可用

+
+ +

句法

+ +
MediaRecorder.ondataavailable = function(event) { ... }
+MediaRecorder.addEventListener('dataavailable', function(event) { ... })
+ +

+ +
...
+  var chunks = [];
+
+  mediaRecorder.onstop = function(e) {
+    console.log("data available after MediaRecorder.stop() called.");
+
+    var audio = document.createElement('audio');
+    audio.controls = true;
+    var blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs=opus' });
+    var audioURL = window.URL.createObjectURL(blob);
+    audio.src = audioURL;
+    console.log("录像停止");
+  }
+
+  mediaRecorder.ondataavailable = function(e) {
+    chunks.push(e.data);
+  }
+
+...
+ +

技术指标

+ + + + + + + + + + + + + + +
规范状态评论
{{SpecName("MediaStream Recording", "#dom-mediarecorder-ondataavailable", "MediaRecorder.ondataavailable")}}{{Spec2("MediaStream Recording")}}初始定义
+ +

浏览器兼容性

+ + + +

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

+ +

也可以看看

+ + diff --git a/files/zh-cn/web/api/mediarecorder/ondataavailable/index.html b/files/zh-cn/web/api/mediarecorder/ondataavailable/index.html deleted file mode 100644 index 48392d0689..0000000000 --- a/files/zh-cn/web/api/mediarecorder/ondataavailable/index.html +++ /dev/null @@ -1,80 +0,0 @@ ---- -title: MediaRecorder.ondataavailable -slug: Web/API/MediaRecorder/ondataavailable -translation_of: Web/API/MediaRecorder/ondataavailable ---- -

{{APIRef("MediaStream Recording")}}

- -

MediaRecorder.ondataavailable 事件处理程序(part of the MediaStream记录API)处理{{event("dataavailable")}}事件,让您在响应运行代码{{domxref("Blob")}}数据被提供使用。

- -

dataavailable当MediaRecorder将媒体数据传递到您的应用程序以供使用时,将触发事件。数据在包含数据的{{domxref("Blob")}}对象中提供。这在四种情况下发生:

- - - -
-

包含媒体数据的{{domxref("Blob")}}在{{event("dataavailable")}}事件的data属性中可用

-
- -

句法

- -
MediaRecorder.ondataavailable = function(event) { ... }
-MediaRecorder.addEventListener('dataavailable', function(event) { ... })
- -

- -
...
-  var chunks = [];
-
-  mediaRecorder.onstop = function(e) {
-    console.log("data available after MediaRecorder.stop() called.");
-
-    var audio = document.createElement('audio');
-    audio.controls = true;
-    var blob = new Blob(chunks, { 'type' : 'audio/ogg; codecs=opus' });
-    var audioURL = window.URL.createObjectURL(blob);
-    audio.src = audioURL;
-    console.log("录像停止");
-  }
-
-  mediaRecorder.ondataavailable = function(e) {
-    chunks.push(e.data);
-  }
-
-...
- -

技术指标

- - - - - - - - - - - - - - -
规范状态评论
{{SpecName("MediaStream Recording", "#dom-mediarecorder-ondataavailable", "MediaRecorder.ondataavailable")}}{{Spec2("MediaStream Recording")}}初始定义
- -

浏览器兼容性

- - - -

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

- -

也可以看看

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