aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/mediastreamaudiosourcenode
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/mediastreamaudiosourcenode
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/api/mediastreamaudiosourcenode')
-rw-r--r--files/zh-cn/web/api/mediastreamaudiosourcenode/index.html150
-rw-r--r--files/zh-cn/web/api/mediastreamaudiosourcenode/mediastreamaudiosourcenode/index.html130
2 files changed, 280 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/mediastreamaudiosourcenode/index.html b/files/zh-cn/web/api/mediastreamaudiosourcenode/index.html
new file mode 100644
index 0000000000..333c7d74a8
--- /dev/null
+++ b/files/zh-cn/web/api/mediastreamaudiosourcenode/index.html
@@ -0,0 +1,150 @@
+---
+title: MediaStreamAudioSourceNode
+slug: Web/API/MediaStreamAudioSourceNode
+tags:
+ - MediaStreamAudioSourceNode
+ - Web Audio API
+translation_of: Web/API/MediaStreamAudioSourceNode
+---
+<p>{{APIRef("Web Audio API")}}</p>
+
+<div>
+<p><code>MediaStreamAudioSourceNode</code> 接口代表一个音频接口,是<a href="/en-US/docs/WebRTC" title="/en-US/docs/WebRTC">WebRTC</a> {{domxref("MediaStream")}} (比如一个摄像头或者麦克风)的一部分。是个表现为音频源的{{domxref("AudioNode")}}。</p>
+</div>
+
+<p><code>MediaElementSourceNode没有输入,并且只有一个输出。创建之后使用</code> {{domxref("AudioContext.createMediaStreamSource")}}方法。输出通道的数量和{{domxref("AudioMediaStreamTrack")}}的通道数量相同。如果没有有效的媒体流,输出通道就变成一个静音的通道。</p>
+
+<table class="properties">
+ <tbody>
+ <tr>
+ <th scope="row">Number of inputs</th>
+ <td><code>0</code></td>
+ </tr>
+ <tr>
+ <th scope="row">Number of outputs</th>
+ <td><code>1</code></td>
+ </tr>
+ <tr>
+ <th scope="row">Channel count</th>
+ <td>由{{domxref("AudioMediaStreamTrack")}}定义,传递给 {{domxref("AudioContext.createMediaStreamSource")}} ,并由此创建。</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="构造器">构造器</h2>
+
+<dl>
+ <dt>{{domxref("MediaStreamAudioSourceNode.MediaStreamAudioSourceNode()")}}</dt>
+ <dd>创建一个新的<code>MediaStreamAudioSourceNode</code>实例。</dd>
+</dl>
+
+<h2 id="属性">属性</h2>
+
+<p><em>从</em><em>{{domxref("AudioNode")}}上继承。</em></p>
+
+<h2 id="方法">方法</h2>
+
+<p><em>从</em><em>{{domxref("AudioNode")}}上继承。</em></p>
+
+<h2 id="示例">示例</h2>
+
+<p>{{page("/zh-CN/docs/Web/API/AudioContext/createMediaStreamSource","示例")}}</p>
+
+<h2 id="规范">规范</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('Web Audio API', '#the-mediastreamaudiosourcenode-interface', 'MediaStreamAudioSourceNode')}}</td>
+ <td>{{Spec2('Web Audio API')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="兼容性">兼容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari (WebKit)</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>14 {{property_prefix("webkit")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoDesktop("25")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>15 {{property_prefix("webkit")}}<br>
+ 22 (unprefixed)</td>
+ <td>6 {{property_prefix("webkit")}}</td>
+ </tr>
+ <tr>
+ <td>Constructor</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</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>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Phone</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatNo}}</td>
+ <td>28 {{property_prefix("webkit")}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatGeckoMobile("25")}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>6 {{property_prefix("webkit")}}</td>
+ </tr>
+ <tr>
+ <td>Constructor</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li><a href="/zh-CN/docs/Web/API/Web_Audio_API/Using_Web_Audio_API">Using the Web Audio API</a></li>
+</ul>
diff --git a/files/zh-cn/web/api/mediastreamaudiosourcenode/mediastreamaudiosourcenode/index.html b/files/zh-cn/web/api/mediastreamaudiosourcenode/mediastreamaudiosourcenode/index.html
new file mode 100644
index 0000000000..14dfc4969b
--- /dev/null
+++ b/files/zh-cn/web/api/mediastreamaudiosourcenode/mediastreamaudiosourcenode/index.html
@@ -0,0 +1,130 @@
+---
+title: MediaStreamAudioSourceNode.MediaStreamAudioSourceNode()
+slug: Web/API/MediaStreamAudioSourceNode/MediaStreamAudioSourceNode
+tags:
+ - MediaStreamAudioSourceNode
+ - Web Audio API
+translation_of: Web/API/MediaStreamAudioSourceNode/MediaStreamAudioSourceNode
+---
+<p>{{APIRef("Web Audio API")}}</p>
+
+<p><code><strong>MediaStreamAudioSourceNode()</strong></code>构造器创建一个新的 {{domxref("MediaStreamAudioSourceNode")}}对象实例。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="brush: js">var myAudioSource = new MediaStreamAudioSourceNode(<em>context</em>, <em>options</em>);</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><em>context</em></dt>
+ <dd>一个用来使用node的音频环境{{domxref("AudioContext")}}。</dd>
+ <dt><em>options</em></dt>
+ <dd><code>MediaStreamAudioSourceOptions</code>,一个map对象,定义<code>MediaStreamAudioSourceNode</code>的属性:
+ <ul>
+ <li><code>mediaStream</code>: 需要使用的音频流</li>
+ </ul>
+ </dd>
+</dl>
+
+<h2 id="示例">示例</h2>
+
+<pre class="brush: js">// define variables
+var audioCtx = new (window.AudioContext || window.webkitAudioContext)();
+
+// getUserMedia block - grab stream 获取音频流
+// put it into a 把音频流放入 MediaStreamAudioSourceNode
+if (navigator.mediaDevices.getUserMedia) {
+ console.log('new getUserMedia supported.');
+ navigator.mediaDevices.getUserMedia (
+ // constraints: audio and video for this app
+ {
+ audio: true,
+ video: false
+ }).then(function(stream) {
+
+ // Create a MediaStreamAudioSourceNode
+ var options = {
+ mediaStream : stream
+ }
+
+ var source = new MediaStreamAudioSourceNode(audioCtx, options);
+ source.connect(audioCtx.destination);
+ }).catch(function(err) {
+ console.log('The following gUM error occured: ' + err);
+ });
+} else {
+ console.log('new getUserMedia not supported on your browser!');
+}</pre>
+
+<h2 id="规范">规范</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('Web Audio API','#idl-def-MediaStreamAudioSourceNode','MediaStreamAudioSourceNode')}}</td>
+ <td>{{Spec2('Web Audio API')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="兼容性">兼容性</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>{{CompatVersionUnknown}}<br>
+  </td>
+ <td>{{CompatNo}}</td>
+ <td>{{ CompatNo }}</td>
+ <td>
+ <p>{{CompatVersionUnknown}}</p>
+ </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>Firefox Mobile (Gecko)</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>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{ CompatNo }}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>