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.


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


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).


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.


© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.

API Audio Guide Intro Media Video WebRTC