Reza hooshangi (8811253) Web rtc
short history • One of the last major challenges for the web is to enable human communication via voice and video: Real Time Communication, RTC for short. • Historically, RTC has been corporate and complex, requiring expensive audio and video technologies to be licensed or developed.
WebRTC has now implemented open standards for real-time, plugin-free video, audio and data communication. • Many web services already use RTC, but need downloads, native apps or plugins. These includes Skype, Facebook (which uses Skype) and Google Hangouts (which use the Google Talk plugin). • Downloading, installing and updating plugins can be complex, error prone and annoying. • Plugins can be difficult to deploy, debug, troubleshoot, test and maintain—and may require licensing and integration with complex, expensive technology. It's often difficult to persuade people to install plugins in the first place!
The guiding principles of the WebRTC project are that its APIs should be open source, free, standardized, built into web browsers and more efficient than existing technologies.
WebRTC applications needs • Get streaming audio, video or other data. • Get network information such as IP address and port, and exchange this with other WebRTC clients (known as peers) to enable connection, even through NATs and firewalls.
Coordinate 'signaling' communication to report errors and initiate or close sessions. • Exchange information about media and client capability, such as resolution and codecs. • Communicate streaming audio, video or data.
WebRTC APIs • MediaStream: get access to data streams, such as from the user's camera and microphone. • RTCPeerConnection: audio or video calling, with facilities for encryption and bandwidth management. • RTCDataChannel: peer-to-peer communication of generic data.
MediaStreamAPI • The MediaStream API represents synchronized streams of media. For example, a stream taken from camera and microphone input has synchronized video and audio tracks. • Each MediaStream has an input, which might be a LocalMediaStream generated bynavigator.getUserMedia(), and an output, which might be passed to a video element or an RTCPeerConnection.
Signaling • WebRTC needs a mechanism to coordinate communication and to send control messages, a process known as signaling. signaling methods and protocols are not specified by WebRTC: signaling is not part of the RTCPeerConnection API.
Instead, WebRTC app developers can choose whatever messaging protocol they prefer, such as SIP or XMPP, and any appropriate duplex (two-way) communication channel.
signaling is used to exchange three types of information: • Session control messages: to initialize or close communication and report errors. • Network configuration: to the outside world, what's my computer's IP address and port? • Media capabilities: what codecs and resolutions can be handled by my browser and the browser it wants to communicate with?
RTCPeerConnection • Once the signaling process has completed successfully, data can be streamed directly peer to peer, between the caller and callee . • Streaming is the job of RTCPeerConnection.
Example • In this example, pc1 represents the local peer (caller) and pc2 represents the remote peer (callee).
Caller • Create a new RTCPeerConnection and add the stream from getUserMedia():
Create an offer and set it as the local description for pc1 and as the remote description for pc2. This can be done directly in the code without using signaling, because both caller and callee are on the same page:
Callee • Create pc2 and, when the stream from pc1is added, display it in a video element:
RTCDataChannel • As well as audio and video, WebRTC supports real-time communication for other types of data. • The RTCDataChannel API will enable peer-to-peer exchange of arbitrary data, with low latency and high throughput.
API use cases • Gaming • Remote desktop applications • Real-time text chat • File transfer
API features • Multiple simultaneous channels, with prioritization. • Reliable and unreliable delivery semantics. • Built-in security (DTLS) • Ability to use with or without audio or video.
RTC security problems • Unencrypted media or data might be intercepted in route between browsers, or between a browser and a server. • An application might record and distribute video or audio without the user knowing. • Malware or viruses might be installed alongside an apparently innocuous plugin or application.
WebRTC Security features • WebRTCimplementations use secure protocols such as DTLS and SRTP. • Encryption is mandatory for all WebRTC components, including signaling mechanisms.
WebRTCis not a plugin: its components run in the browser sandbox and not in a separate process, components do not require separate installation, and are updated whenever the browser is updated.
Camera and microphone access must be granted explicitly and, when the camera or microphone are running, this is clearly shown by the user interface.
WebRTC support MediaStreamand getUserMedia • Chrome 18.0.1008+ • Opera, Opera Mobile 12 • Firefox 17+
RTCPeerConnection • Chrome 20+ • Firefox Aurora/Nightly
RTCDataChannel • Experimental version in Chrome 25, more stable in Chrome 26 • Firefox Aurora/Nightly
References • http://www.html5rocks.com/en/tutorials/webrtc/basics/ • http://apprtc.appspot.com/ • http://en.wikipedia.org/wiki/WebRTC • http://www.webrtc.org/