WebRTC(網路即時通訊技術)是一個提供 Web 應用程式及網站進行錄影或隨選播放串流音訊與影像的技術,可以直接使用瀏覽器進行資料交換而無須透過中介服務。作為一個標準規格,WebRTC 可以提供任何瀏覽器在不需要安裝外掛程式或第三方軟體下,分享應用程式的資料和進行電話會議。

WebRTC 由數個相關而互相協作的 API 以及網路協定組成。

這裡的技術文件會幫助你了解 :

WebRTC 的基本構成,如何設置並同時使用其資料與媒體傳輸連線,以及更多有關資訊。

WebRTC 概念與使用

WebRTC 有許多服務目的,基本涵括了媒體獲取與串流 API,他們為網頁提供了強大的多媒體功能,包括: 音視訊會議,檔案傳輸,身分識別管理,以及提供以傳輸DTMF (en-US)訊號來與現存電話系統交互的介面。


WebRTC serves multiple purposes, and overlaps substantially with the Media Capture and Streams API. Together, they provide powerful multimedia capabilities to the Web, including support for audio and video conferencing, file exchange, identity management, and interfacing with legacy telephone systems by sending DTMF (en-US) signals. Connections between peers can be made without requiring any special drivers or plug-ins, and can often be made without any intermediary servers.

Connections between two peers are created using—and represented by—the RTCPeerConnection (en-US) interface. Once a connection has been established and opened, media streams (MediaStream (en-US)s) and/or data channels (RTCDataChannel (en-US)s) can be added to the connection.

Media streams can consist of any number of tracks of media information; tracks, which are represented by objects based on the MediaStreamTrack (en-US) interface, may contain one of a number of types of media data, including audio, video, and text (such as subtitles or even chapter names). Most streams consist of at least one audio track and likely also a video track, and can be used to send and receive both live media or stored media information (such as a streamed movie).

You can also use the connection between two peers to exchange arbitrary binary data using the RTCDataChannel (en-US) interface. This can be used for back-channel information, metadata exchange, game status packets, file transfers, or even as a primary channel for data transfer.

more details and links to relevant guides and tutorials needed

WebRTC interfaces

Because WebRTC provides interfaces that work together to accomplish a variety of tasks, we have divided up the interfaces in the list below by category. Please see the sidebar for an alphabetical list.

Connection setup and management

These interfaces are used to set up, open, and manage WebRTC connections.

RTCPeerConnection (en-US)

Represents a WebRTC connection between the local computer and a remote peer. It is used to handle efficient streaming of data between the two peers.

RTCDataChannel (en-US)

Represents a bi-directional data channel between two peers of a connection.

RTCDataChannelEvent (en-US)

Represents events that occur while attaching a RTCDataChannel (en-US) to a RTCPeerConnection (en-US). The only event sent with this interface is datachannel (en-US).

RTCSessionDescription (en-US)

Represents the parameters of a session. Each RTCSessionDescription consists of a description type (en-US) indicating which part of the offer/answer negotiation process it describes and of the SDP (en-US) descriptor of the session.

RTCStatsReport (en-US)

Provides information detailing statistics for a connection or for an individual track on the connection; the report can be obtained by calling RTCPeerConnection.getStats() (en-US).

RTCIceCandidate (en-US)

Represents a candidate internet connectivity establishment (ICE) server for establishing an RTCPeerConnection (en-US).

RTCIceTransport (en-US)

Represents information about an internet connectivity establishment (ICE) transport.

RTCPeerConnectionIceEvent (en-US)

Represents events that occurs in relation to ICE candidates with the target, usually an RTCPeerConnection (en-US). Only one event is of this type: icecandidate (en-US).

RTCRtpSender (en-US)

Manages the encoding and transmission of data for a MediaStreamTrack (en-US) on an RTCPeerConnection (en-US).

RTCRtpReceiver (en-US)

Manages the reception and decoding of data for a MediaStreamTrack (en-US) on an RTCPeerConnection (en-US).

RTCTrackEvent (en-US)

Indicates that a new incoming MediaStreamTrack (en-US) was created and an associated RTCRtpReceiver (en-US) object was added to the RTCPeerConnection (en-US) object.

Identity and security

These APIs are used to manage user identity and security, in order to authenticate the user for a connection.


Enables a user agent is able to request that an identity assertion be generated or validated.

RTCIdentityAssertion (en-US)

Represents the identity of the remote peer of the current connection. If no peer has yet been set and verified this interface returns null. Once set it can't be changed.


Registers an identity provider (idP).

RTCCertificate (en-US)

Represents a certificate that an RTCPeerConnection (en-US) uses to authenticate.


These interfaces are related to interactivity with public-switched telephone networks (PTSNs).

RTCDTMFSender (en-US)

Manages the encoding and transmission of dual-tone multi-frequency (DTMF) signaling for an RTCPeerConnection (en-US).

RTCDTMFToneChangeEvent (en-US)

Indicates an occurrence of a of dual-tone multi-frequency (DTMF). This event does not bubble (except where otherwise stated) and is not cancelable (except where otherwise stated).


Introduction to WebRTC protocols (en-US)

This article introduces the protocols on top of which the WebRTC API is built.

WebRTC connectivity (en-US)

A guide to how WebRTC connections work and how the various protocols and interfaces can be used together to build powerful communication apps.

Lifetime of a WebRTC session (en-US)

WebRTC lets you build peer-to-peer communication of arbitrary data, audio, or video—or any combination thereof—into a browser application. In this article, we'll look at the lifetime of a WebRTC session, from establishing the connection all the way through closing the connection when it's no longer needed.

Signaling and two-way video calling (en-US)

A tutorial and example which turbs a WebSocket-based chat system created for a previous example and adds support for opening video calls among participants. The chat server's WebSocket connection is used for WebRTC signaling.

Using WebRTC data channels (en-US)

This guide covers how you can use a peer connection and an associated RTCDataChannel (en-US) to exchange arbitrary data between two peers.

Using DTMF with WebRTC (en-US)

WebRTC's support for interacting with gateways that link to old-school telephone systems includes support for sending DTMF tones using the RTCDTMFSender (en-US) interface. This guide shows how to do so.


Improving compatibility using WebRTC adapter.js (en-US)

The WebRTC organization provides on GitHub the WebRTC adapter to work around compatibility issues in different browsers' WebRTC implementations. The adapter is a JavaScript shim which lets your code to be written to the specification so that it will "just work" in all browsers with WebRTC support.

Taking still photos with WebRTC (en-US)

This article shows how to use WebRTC to access the camera on a computer or mobile phone with WebRTC support and take a photo with it.

一個簡單的 RTCDataChannel 範例 (en-US)

RTCDataChannel (en-US) 介面用於讓兩端點間建立起資料的通道,你可以利用通道來收發資料。這組 API 被設計成與 WebSocket API (en-US) 相似,所以可以利用同樣的程式模型套用在這兩套 API 之上。




WebRTC: Real-Time Communication in Browsers
Media Capture and Streams
Media Capture from DOM Elements

In additions to these specifications defining the API needed to use WebRTC, there are several protocols, listed under resources.