この翻訳は不完全です。英語から この記事を翻訳 してください。

RTCPeerConnection() コンストラクターはRTCPeerConnectionを新たに作成し、返します。これは、ローカルデバイスとリモートピアの間の接続を表現します。

構文

pc = new RTCPeerConnection([configuration]);

引数

configuration Optional
An RTCConfiguration dictionary providing options to configure the new connection.

RTCConfiguration dictionary

bundlePolicy Optional
Specifies how to handle negotiation of candidates when the remote peer is not compatible with the SDP BUNDLE standard. This must be one of the values from the enum RTCBundlePolicy. If this value isn't included in the dictionary, "balanced" is assumed.
certificates Optional
An Array of objects of type RTCCertificate which are used by the connection for authentication. If this property isn't specified, a set of certificates is generated automatically for each RTCPeerConnection instance. Although only one certificate is used by a given connection, providing certificates for multiple algorithms may improve the odds of successfully connecting in some circumstances. See Using certificates below for additional information.
This configuration option cannot be changed after it is first specified; once the certificates have been set, this property is ignored in future calls to RTCPeerConnection.setConfiguration().
iceCandidatePoolSize Optional
An unsigned 16-bit integer value which specifies the size of the prefetched ICE candidate pool. The default value is 0 (meaning no candidate prefetching will occur). You may find in some cases that connections can be established more quickly by allowing the ICE agent to start fetching ICE candidates before you start trying to connect, so that they're already available for inspection when RTCPeerConnection.setLocalDescription() is called.
Changing the size of the ICE candidate pool may trigger the beginning of ICE gathering.
iceServers Optional
An array of RTCIceServer objects, each describing one server which may be used by the ICE agent; these are typically STUN and/or TURN servers. If this isn't specified, the ICE agent may choose to use its own ICE servers; otherwise, the connection attempt will be made with no STUN or TURN server available, which limits the connection to local peers.
iceTransportPolicy Optional
The current ICE transport policy; this must be one of the values from the RTCIceTransportPolicy enum. If this isn't specified, "all" is assumed.
peerIdentity Optional
A DOMString which specifies the target peer identity for the RTCPeerConnection. If this value is set (it defaults to null), the RTCPeerConnection will not connect to a remote peer unless it can successfully authenticate with the given name.
rtcpMuxPolicy Optional
The RTCP mux policy to use when gathering ICE candidates, in order to support non-multiplexed RTCP. The value must be one of those from the RTCRtcpMuxPolicy enum. The default is "require".

返値

新たに作成されたRTCPeerConnectionオブジェクトを返します。configurationが設定されていればそれに従って、設定されていなければデフォルトの値が適切に設定されます。

仕様

Specification Status Comment
WebRTC 1.0: Real-time Communication Between Browsers
RTCPeerConnection() の定義
勧告候補 Initial definition.

ブラウザ実装状況

Update compatibility data on GitHub
デスクトップモバイル
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewAndroid 版 ChromeEdge MobileAndroid 版 FirefoxAndroid 版 OperaiOSのSafariSamsung Internet
基本対応Chrome 完全対応 56
補足
完全対応 56
補足
補足 Before Chrome 63 the default value for the RTCConfiguration.rtcpMuxPolicy parameter was "negotiate&quot
Edge 完全対応 ありFirefox 完全対応 22IE ? Opera 完全対応 43
補足
完全対応 43
補足
補足 Promise based version.
未対応 37 — 43
Safari ? WebView Android 完全対応 56
補足
完全対応 56
補足
補足 Before Chrome 63 the default value for the RTCConfiguration.rtcpMuxPolicy parameter was "negotiate&quot
Chrome Android 完全対応 56
補足
完全対応 56
補足
補足 Before Chrome 63 the default value for the RTCConfiguration.rtcpMuxPolicy parameter was "negotiate&quot
Edge Mobile 完全対応 ありFirefox Android 完全対応 44Opera Android 完全対応 43
補足
完全対応 43
補足
補足 Promise based version.
未対応 37 — 43
Safari iOS ? Samsung Internet Android 完全対応 6.0

凡例

完全対応  
完全対応
実装状況不明  
実装状況不明
実装ノートを参照してください。
実装ノートを参照してください。

関連項目

ドキュメントのタグと貢献者

このページの貢献者: hikarino
最終更新者: hikarino,