aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/rtcpeerconnection/getreceivers/index.html
blob: 4f59be48af9a302f556fbb671605b51da58c59a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
---
title: RTCPeerConnection.getReceivers()
slug: Web/API/RTCPeerConnection/getReceivers
tags:
  - Media
  - RTCPeerConnection
  - WebRTC
  - getReceivers
translation_of: Web/API/RTCPeerConnection/getReceivers
---
<div>{{APIRef("WebRTC")}}{{SeeCompatTable}}</div>

<p><code><strong>RTCPeerConnection.getReceivers()</strong></code> 方法返回一个 {{domxref("RTCRtpReceiver")}} 对象的数组, 每个RTCRtpReceiver对象代表了一个RTP receiver。每个RTP receiver管理在一个 {{domxref("RTCPeerConnection")}} 上的 {{domxref("MediaStreamTrack")}} 的数据的接收与解码。</p>

<h2 id="Syntax" name="Syntax">语法</h2>

<pre class="syntaxbox notranslate">var <em>receivers</em> = <em>rtcPeerConnection</em>.getReceivers();
</pre>

<h3 id="返回值">返回值</h3>

<p>一个 {{domxref("RTCRtpReceiver")}} 数组,一个对象就是连接上的一个轨道(track)。若连接上没有RTP receiver,则数组为空。</p>

<p>规范没有定义返回的<font face="consolas, Liberation Mono, courier, monospace">RTCRtpReceiver实例的顺序,所以两次调用</font> <code>getReceivers()</code> 返回的顺序可能是不同的。</p>

<h2 id="Example" name="Example">例子</h2>

<p>待定</p>

<h2 id="Specifications" name="Specifications">技术规范</h2>

<table class="standard-table" style="height: 49px; width: 1000px;">
 <thead>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{ SpecName('WebRTC 1.0', '#dom-peerconnection-getreceivers', 'RTCPeerConnection.getReceivers()') }}</td>
   <td>{{ Spec2('WebRTC 1.0') }}</td>
   <td>Initial specification.</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>



<p>{{Compat("api.RTCPeerConnection.getReceivers")}}</p>

<h2 id="参阅">参阅</h2>

<ul>
 <li><a href="/en-US/docs/Web/Guide/API/WebRTC_API">WebRTC</a></li>
 <li>{{domxref("RTCRtpSender")}}</li>
</ul>