WebRTC API
Summary
Enables real-time communication across the web.
- MediaStream
- The MediaStream interface of the WebRTC API describes a stream of audio or video data. A MediaStream object represents a linear, potentially infinite timeline. It is not preloadable, nor is it seekable.
Usage
The RTC in WebRTC stands for Real-Time Communications, technology that enables audio/video streaming and data sharing between browser clients (peers). As a set of standards, WebRTC provides any browser with the ability to share application data and perform teleconferencing peer to peer, without the need to install plug-ins or third-party software.
WebRTC components are accessed with JavaScript APIs. Currently in development are the Network Stream API, which represents an audio or video data stream, and the PeerConnection API, which allows two or more users to communicate browser-to-browser. Also under development is a DataChannel API that enables communication of other types of data for real-time gaming, text chat, file transfer, and so forth.
MediaStream API
A MediaStream object is typically set as a simple URL string which can be used to reference data stored in a DOM File or Blob object with window.URL.createObjectURL(). The MediaStream object is further distinguished as either a MediaStreamTrack or a LocalMediaStream.
A MediaStream consists of zero or more MediaStreamTrack objects, which comprise one or more channels, and which are contained in a MediaStreamTrackList. Each MediaStreamTrack may have one or more channels. The channel represents the smallest unit of a media stream, such as an audio signal.
MediaStream objects have an input and an output. A LocalMediaStream is a MediaStream object generated by getUserMedia(), and which has as its source input the user’s camera or microphone. The output describes how the consumer uses the MediaStream object. The consumer is either of the media elements, <audio>
or <video>
, or the PeerConnection API.
PeerConnection API
The PeerConnection API, represented chiefly by the RTCPeerConnection object, provides for the exchange of MediaStream object data between browser instances (peers) across a secure channel. The process starts with signaling from one peer to others through a server. The signaling protocol is determined by the application, and once established, encapsulated in the RTCSessionDescription object.
DataChannel API
TODO: Add more information here.
The DataChannel API, represented by the RTCDataChannel and leveraged through RTCPeerConnection, provides for the exchange of strings or binary data between peers. A data channel can be reliable, semi reliable and not reliable.
See also
Related articles
WebRTC
External resources
- WebRTC working group
- PeerConnection API (includes DataChannel)
- Media Capture and Streams API