WebRTC (Web Real-Time Communications) is a technology which enables Web applications and sites to capture and optionally stream audio and/or video media, as well as to exchange arbitrary data between browsers without requiring an intermediary. The set of standards that comprises WebRTC makes it possible to share data and perform teleconferencing peer-to-peer, without requiring that the user install plug-ins or any other third-party software.
WebRTC consists of several interrelated APIs and protocols which work together to achieve this. The documentation you'll find here will help you understand the fundamentals of WebRTC, how to set up and use both data and media connections, and more.
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 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
interface. Once a connection has been established and opened, media streams (MediaStream
s) and/or data channels (RTCDataChannel
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
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
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
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.
These interfaces are used to set up, open, and manage WebRTC connections.
RTCPeerConnection
RTCDataChannel
RTCDataChannelEvent
RTCDataChannel
to a RTCPeerConnection
. The only event sent with this interface is datachannel
.RTCSessionDescription
RTCSessionDescription
consists of a description type
indicating which part of the offer/answer negotiation process it describes and of the SDP descriptor of the session.RTCSessionDescriptionCallback
RTCStatsReport
RTCPeerConnection.getStats()
.RTCIceCandidate
RTCPeerConnection
.RTCIceTransport
RTCPeerConnectionIceEvent
RTCPeerConnection
. Only one event is of this type: icecandidate
.RTCRtpSender
MediaStreamTrack
on an RTCPeerConnection
.RTCRtpReceiver
MediaStreamTrack
on an RTCPeerConnection
.RTCRtpContributingSource
RTCTrackEvent
MediaStreamTrack
was created and an associated RTCRtpReceiver
object was added to the RTCPeerConnection
object.RTCConfiguration
RTCPeerConnection
.RTCSctpTransport
RTCPeerConnection
's data channels are sent and received.The WebRTC API includes a number of interfaces to manage security and identity.
RTCIdentityProvider
RTCIdentityAssertion
null
. Once set it can't be changed.RTCIdentityProviderRegistrar
RTCIdentityEvent
RTCPeerConnection
. The only event sent with this type is identityresult
.RTCIdentityErrorEvent
RTCPeerConnection
. Two events are sent with this type: idpassertionerror
and idpvalidationerror
.RTCCertificate
RTCPeerConnection
uses to authenticate.These interfaces are related to interactivity with public-switched telephone networks (PTSNs).
RTCDTMFSender
RTCPeerConnection
.RTCDTMFToneChangeEvent
RTCIceServer
RTCDataChannel
to exchange arbitrary data between two peers.RTCDTMFSender
interface. This guide shows how to do so.RTCDataChannel
interface is a feature which lets you open a channel between two peers over which you may send and receive arbitrary data. The API is intentionally similar to the WebSocket API, so that the same programming model can be used for each.Specification | Status | Comment |
---|---|---|
WebRTC 1.0: Real-time Communication Between Browsers | Working Draft | The initial definition of the API of WebRTC. |
Media Capture and Streams | Editor's Draft | The initial definition of the object conveying the stream of media content. |
Media Capture from DOM Elements | Editor's Draft | The initial definition on how to obtain stream of content from DOM Elements |
In additions to these specifications defining the API needed to use WebRTC, there are several protocols, listed under resources.
MediaDevices
MediaStreamEvent
MediaStreamConstraints
MediaStreamTrack
MessageEvent
MediaStream
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API