WebRTC (Web Real-Time Communication) is an open real-time communication technology that allows web browsers and mobile applications to conduct peer-to-peer audio/video calls and data sharing without the need for plugins.
The main components of WebRTC include:
-
Media Capture Layer: Accesses the user's camera and microphone through the
getUserMedia()API. -
Media Processing Layer: Includes codecs, echo cancellation, noise suppression, and other audio/video processing functions.
-
Transport Layer: Based on UDP's SRTP (Secure Real-time Transport Protocol) and SCTP (Stream Control Transmission Protocol), ensuring secure data transmission.
-
Signaling Layer: Responsible for establishing and maintaining communication sessions, including session initialization, media negotiation, network address negotiation, etc. Developers need to implement this themselves, typically using WebSocket or HTTP.
-
P2P Network Layer: Includes ICE (Interactive Connectivity Establishment), STUN (Session Traversal Utilities for NAT), and TURN (Traversal Using Relays around NAT), used to establish peer-to-peer connections in NAT and firewall environments.
-
API Layer: JavaScript APIs provided for developers to use, including
RTCPeerConnection,RTCSessionDescription,RTCIceCandidate, etc.