현재 번역은 완벽하지 않습니다. 한국어로 문서 번역에 동참해주세요.
WebRTC(Web Real-Time Communications)란, 웹 어플리케이션(최근에는 android 및 ios도 지원) 및 사이트들이 별도의 소프트웨어 없이 음성, 영상 미디어 혹은 텍스트, 파일 같은 데이터를 브라우져끼리 주고 받을 수 있게 만든 기술이다. WebRTC로 구성된 프로그램들은 별도의 플러그인이나 소프트웨어 없이 p2p 화상회의 및 데이터 공유를 한다.
WebRTC는 서로 상호 작용하는 API들과 Protocol들로 구성되어 있다. 이 문서에서 WebRTC의 기초적이고 핵심적인 부분과, 어떻게 데이터, 음성, 영상 데이터들을 공유하는지에 대해서 배우게 될 것이다.
WebRTC concepts and usage
WebRTC는 여러가지 목적으로 사용될 수 있으며, Media Capture and Streams API 와 상당히 많은 부분이 겹친다. 이 둘은 서로 상호작용을 하면서 웹에 강력한 멀티미디어 기능을 제공한다. 예를들어 음성, 화상 회의, 파일 교환, 계정 관리, DTMF 시그널을 이용해 legacy telephone 시스템 interfacing 등이 있다. 피어들 간의 커넥션이 만들어지는데 어떤 드라이버나 플러그인도 필요하지 않는다. 그리고 가끔은 중개 서버 없이도 만들어질 수 있다.
두 피어 간의 커넥션은 RTCPeerConnection인터페이스를 통해 이루어진다. 커넥션이 이루어지고 열리면, 미디어 스트림들 (MediaStream) 과 데이터 채널(RTCDataChannel)들을 커넥션에 연결할 수 있다.
미디어 스트림들은 미디어 정보를 가지는 다수의 트랙들로 구성될 수 있다. MediaStreamTrack인터페이스 object를 베이스로 하는 트랙은 음성, 영상 및 텍스트(제목 또는 챕터 이름 조차도 포함 가능하다)를 포함하는 다양한 미디어 데이터의 타입 중 하나를 포함 할 수 있다. 대부분의 스트림들은 적어도 한 개 이상의 음성(영상) 트랙으로 구성되어 있고, live 미디어(웹 캠 등)나 저장된(스트리밍) 미디어들을 전송하고 받을 수 있다.
또한, 임의의 바이너리 데이터(이미지든 텍스트든 파일이든 모두 가능하다는 뜻)를 RTCDataChannel인터페이스를 통해 피어들 간에 교환할 수 있다. 이것은 back-channel 정보들, 메타데이터 교환, 게임 status 패킷들, 파일 교환, 데이터 교환을 위한 primary channel 등에 쓰일 수 있다.
더 자세한 내용은 밑에 guide와 tutorial을 참조하길 바란다
WebRTC interfaces
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.
Connection setup and management
These interfaces are used to set up, open, and manage WebRTC connections.
RTCPeerConnection- Represents a WebRTC connection between the local computer and a remote peer. It is used to handle efficient streaming of data between the two peers.
RTCDataChannel- Represents a bi-directional data channel between two peers of a connection.
RTCDataChannelEvent- Represents events that occur while attaching a
RTCDataChannelto aRTCPeerConnection. The only event sent with this interface isdatachannel. RTCSessionDescription- Represents the parameters of a session. Each
RTCSessionDescriptionconsists of a descriptiontypeindicating which part of the offer/answer negotiation process it describes and of the SDP descriptor of the session. RTCStatsReport- Provides information detailing statistics for a connection or for an individual track on the connection; the report can be obtained by calling
RTCPeerConnection.getStats(). RTCIceCandidate- Represents a candidate internet connectivity establishment (ICE) server for establishing an
RTCPeerConnection. RTCIceTransport- Represents information about an internet connectivity establishment (ICE) transport.
RTCPeerConnectionIceEvent- Represents events that occurs in relation to ICE candidates with the target, usually an
RTCPeerConnection. Only one event is of this type:icecandidate. RTCRtpSender- Manages the encoding and transmission of data for a
MediaStreamTrackon anRTCPeerConnection. RTCRtpReceiver- Manages the reception and decoding of data for a
MediaStreamTrackon anRTCPeerConnection. RTCTrackEvent- Indicates that a new incoming
MediaStreamTrackwas created and an associatedRTCRtpReceiverobject was added to theRTCPeerConnectionobject.
Identity and security
The WebRTC API includes a number of interfaces to manage security and identity.
RTCIdentityProvider- Enables a user agent is able to request that an identity assertion be generated or validated.
RTCIdentityAssertion- Represents the identity of the a remote peer of the current connection. If no peer has yet been set and verified this interface returns
null. Once set it can't be changed. RTCIdentityProviderRegistrar- Registers an identity provider (idP).
RTCIdentityEvent- Represents an identity assertion generated by an identity provider (idP). This is usually for an
RTCPeerConnection. The only event sent with this type isidentityresult. RTCIdentityErrorEvent- Represents an error associated with the identity provider (idP). This is usually for an
RTCPeerConnection. Two events are sent with this type:idpassertionerrorandidpvalidationerror. RTCCertificate- Represents a certificate that an
RTCPeerConnectionuses to authenticate.
Telephony
These interfaces are related to interactivity with public-switched telephone networks (PTSNs).
RTCDTMFSender- Manages the encoding and transmission of dual-tone multi-frequency (DTMF) signaling for an
RTCPeerConnection. RTCDTMFToneChangeEvent- Indicates an occurrence of a of dual-tone multi-frequency (DTMF). This event does not bubble (except where otherwise stated) and is not cancelable (except where otherwise stated).
Guides
- Introduction to WebRTC protocols
- This article introduces the protocols on top of which the WebRTC API is built.
- WebRTC connectivity
- A guide to how WebRTC connections work and how the various protocols and interfaces can be used together to build powerful communication apps.
- Lifetime of a WebRTC session
- WebRTC lets you build peer-to-peer communication of arbitrary data, audio, or video—or any combination thereof—into a browser application. In this article, we'll look at the lifetime of a WebRTC session, from establishing the connection all the way through closing the connection when it's no longer needed.
- Signaling and two-way video calling
- 여러 사용자들 간의 화상통화를 할 수 있는 Websocket을 기반으로한 튜토리얼 및 예제이다. 채팅 서버의 웹소켓 커넥션은 WebRTC의 시그널링을 위해 사용된다.
- Using WebRTC data channels
- This guide covers how you can use a peer connection and an associated
RTCDataChannelto exchange arbitrary data between two peers. - Using DTMF with WebRTC
- WebRTC's support for interacting with gateways that link to old-school telephone systems includes support for sending DTMF tones using the
RTCDTMFSenderinterface. This guide shows how to do so.
Tutorials
- Improving compatibility using WebRTC adapter.js
- The WebRTC organization provides on GitHub the WebRTC adapter to work around compatibility issues in different browsers' WebRTC implementations. The adapter is a JavaScript shim which lets your code to be written to the specification so that it will "just work" in all browsers with WebRTC support.
- Taking still photos with WebRTC
- This article shows how to use WebRTC to access the camera on a computer or mobile phone with WebRTC support and take a photo with it.
- A simple RTCDataChannel sample
- The
RTCDataChannelinterface 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.
Resources
Protocols
WebRTC-proper protocols
- Application Layer Protocol Negotiation for Web Real-Time Communications
- WebRTC Audio Codec and Processing Requirements
- RTCWeb Data Channels
- RTCWeb Data Channel Protocol
- Web Real-Time Communication (WebRTC): Media Transport and Use of RTP
- WebRTC Security Architecture
- Transports for RTCWEB
Related supporting protocols
- Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal for Offer/Answer Protocol
- Session Traversal Utilities for NAT (STUN)
- URI Scheme for the Session Traversal Utilities for NAT (STUN) Protocol
- Traversal Using Relays around NAT (TURN) Uniform Resource Identifiers
- An Offer/Answer Model with Session Description Protocol (SDP)
- Session Traversal Utilities for NAT (STUN) Extension for Third Party Authorization
Specifications
| 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.