WebRTC API overview

WebRTC consists of several interrelated APIs and protocols which work together to support the exchange of data and media between two or more peers. This article provides a brief overview of each of these APIs and what purpose it serves.

RTCPeerConnection

Before media can be exchanged, or a data channel established, you need to link two peers together. This is accomplished using the RTCPeerConnection interface.

MediaStream

The MediaStream interface represents a stream of media data being transmitted from one peer to another. This stream consists of one or more tracks; typically this is an audio track and a video track. A stream can transmit live media (for audio calls or videoconferencing) or stored media (such as a streamed movie).

RTCDataChannel

WebRTC lets you use the connection between two peers to transmit arbitrary binary data back and forth. This is accomplished using the RTCDataChannel interface.

This can be used for back-channel information, or even as your primary channel for exchanging any kind of data you wish. For games, it could be used to implement multiplayer support, transmitting player movement updates and the like back and forth.

Document Tags and Contributors

 Contributors to this page: teoli, Sheppy
 Last updated by: teoli,