WebRTC 简介及服务搭建、测试
WebRTC主要解决如下三个问题
1、获取音频和视频。 可以访问输入设备,如话筒、(网络)摄像机(头),可以从上述设备获取媒体数据流。目前需要硬件设备支持VP8/VP9,如果设备仅仅支持H.264/H.265(HEVC:High Efficiency Video Coding),则无法使用WebRTC进行编解码传输存储。
2、音频和视频交互通讯。 通过互联网,连接其它WebRTC终端,并且实时发送这些音视频流。
3、任意数据的交互通讯。 通过互联网,连接其它WebRTC终端,实时发送其它任意应用数据。
针对上述三个问题,WebRTC上使用的三种重要的JavaScript API
- MediaStream(aka getUserMedia)访问媒体
- RTCPeerConnection
- RTCDataChannel
简介:
1. Web Real Time Communication
2. What’s WebRTC?
WebRTC is a new front in the long war for an open and unencumbered web. — Brendan Eich , inventor of JavaScript
3. What’s WebRTC?
Web Real-Time Communication (WebRTC) is an upcoming standard that aims to enable real-time communication among Web browsers in a peer-to-peer fashion.
WebRTC project (opensource) aims to allow browsers to natively support interactive peer to peer communications and real time data collaboration.
Provide state of art audio/video communication stack in your browser.
4. Earlier Efforts?
Many web services already use RTC, but need downloads, native apps or plugins. These includes Skype, Facebook (uses Skype) and Google Hangouts (uses 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. 4? Integrating RTC technology with existing content, data and
5. What does it change? No licenses or other fees. Integration via simple, standardized Web APIs. No Proprietary plugins. No Security issues. No downloads, no installation. Just surf to the right address!
6. Aims of WebRTC?
State of art audio/video communication stack in your browser. Seamless person-to-person communication. Specification to achieve inter-operability among Web browsers. Interoperability with legacy systems. Low cost and highly efficient communication solution
7. Architecture
8. Architecture? At startup, browsers do not know each other. JavaScript mediates the setup process through server. Media flows through the shortest possible path for latency.
9. How peers connect?
10. WebRTC Media Engine
11. WebRTC App. Need TO? 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 ). Coordinate signaling communication to report errors and initiate or close sessions. Exchange information about media and client capability, such as resolution and codecs. 11? Communicate streaming audio, video or data.
12. Signaling? Mechanism to coordinate communication and to send control messages. Signaling methods and protocols are not specified by WebRTC but by application developer.
Signaling is used to exchange three types of information :
Session control messages : to initialize or close communication and report errors.
Network configuration : whats my computers IP address and port?
13. Signaling
The original idea to exchange Session Description information was in the form of Session Description Protocol (SDP) "blobs".
This approach had several shortcomings some of which would be difficult to address.
IETF is standardizing the JavaScript Session Establishment Protocol (JSEP).
JSEP provides the interface an application needs to deal with the negotiated local and remote session descriptions.
The JSEP approach leaves the responsibility for driving the signaling state machine entirely to the application.
14. WebRTC API
getUserMedia (MediaStream)
RTCPeerConnection
RTCDataChannel
15. WebRTC API Stack View
16. getUserMedia
A MediaStream is an abstract representation of an actual data stream of audio or video. Serves as a handle for managing actions on the media stream. A MediaStream can be extended to represent a stream that either comes from (remote stream) or is sent to (local stream) a remote node. A LocalMediaStream represents a media stream from a local media-capture device (such as a webcam or microphone).
17. getUserMedia
The MediaStream represents synchronized streams of media. For example, a stream taken from camera and microphone input has synchronized video and audio tracks. The getUserMedia() method takes three parameters: A constraints object. A success callback which, if called, is passed a LocalMediaStream. A failure callback which, if called, is passed an error object. In Chrome, the URL.createObjectURL () method converts a LocalMediaStream to a Blob URL which can be set as the src of a
18. getUserMedia
<video id="sourcevid" autoplay>
</video>
<script> var video = document.getElementById('sourcevid');
navigator.getUserMedia(video, success, error);
function success(stream)
{
video.src =window.URL.createObjectURL(stream);
}
</script>
19. RTCPeerConnection
RTCPeerConnection is the WebRTC API that handles stable and efficient communication of streaming data between peers . Communications are coordinated via a signaling channel provided by scripting code in the page via the Web server — for instance, using XMLHttpRequest or WebSocket.
20. RTCPeerConnectionIn the real world, WebRTC needs servers, so the followingcan happen:? Users discover each other and exchange real world details such as names. WebRTC client applications (peers) exchange network information. Peers exchange data about media such as video format and resolution.
21. RTCPeerConnection
22. NAT Traversal
Suffice to say that the STUN protocol and its extension TURN are used by the ICE framework to enable RTCPeerConnection to cope with NAT traversal. Initially, ICE tries to connect peers directly , with the lowest possible latency, via UDP. In this process, STUN servers have a single task: to enable a peer behind a NAT to find out its public address and port.
If UDP fails,
ICE tries TCP: first HTTP, then HTTPS.
If direct connection fails—in particular, because of enterprise NAT traversal and firewalls—ICE uses an intermediary (relay) TURN server.
In other words, ICE will first use STUN with UDP to directly connect peers and, if that fails, will fall back to a TURN relay server.
The expression finding candidates refers to the process of
25. NAT Traversal
26. 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.
The API has several features to make the most of RTCPeerConnection and enable powerful and flexible peer-to-peer communication.
27. RTCDataChannel
Stream Control Transmission Protocol (SCTP) encapsulated in DTLS is used to handle DataChannel Data.
DataChannel API is bidirectional, which means that each DataChannel bundles an incoming and an outgoing SCTP stream.
Encapsulating "SCTP over DTLS over ICE over UDP" provides a NAT traversal solution together with confidentiality, source authentication, and integrity protected transfers.
28. SecurityThere are several ways a real-time communication applicationor plugin might compromise security.
For example: Unencrypted media or data might be intercepted en 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.
29. Security
WebRTC has several features to avoid these problems: WebRTC implementations use secure protocols such as DTLS and SRTP.
Encryption is mandatory for all WebRTC components, including signaling mechanisms.
WebRTC is 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.
30. Current Limitations
Cloud Infrastructure – A server is required by WebRTC to complete four tasks: User discovery, Signalling and NAT/firewall traversal.
Native Applications – WebRTC enables real-time communication between web browsers. It is not a software development kit that can be used in native iOS or Android applications or in native desktop applications.
Multiparty Conferencing – WebRTC is peer-to-peer by nature which allows WebRTC to be extremely scalable, but it is very inefficient when setting up communications between more than two end users.
Recording – WebRTC does not support recording as of now.
31. Conclusion
The APIs and standards of WebRTC can democratize and decentralize tools for content creation and communication — for telephony, gaming, video production, music making, news gathering and many other applications.
WebRTC will have great impact on open web and interoperable browser technologies including the existing enterprise solutions.
References
Salvatore Loreto, Simon Pietro Romano (2012) ‘Real-Time Communications in the Web’ - IEEE paper October, 2012
IETF.org
WebRTC book by Alan B. Johnston and Daniel C. Burnett : webrtcbook.com
Video of Justin Ubertis WebRTC session at Google I/O, 27 June 2012.
webrtc.org
Google Developers Google Talk documentation, which gives more information about NAT traversal, STUN, relay servers and candidate gathering.
WebPlatform.org (http://docs.webplatform.org/wiki/concepts/internet_and_web/web
Demo:simpl.info/dc
部署调试WebRTC的步骤详细记录如下:
参考:
https://www.youtube.com/watch?v=p2HzZkd2A40
https://www.slideshare.net/dhamavijays/webrtc-17414738
https://www.youtube.com/watch?v=p2HzZkd2A40
http://transcriptvids.com/v2/p2HzZkd2A40.html
WebRTC 简介及服务搭建、测试的更多相关文章
- AppRTC服务搭建(测试)
提供一个在线的webrtc服务器测试,需要的朋友看看.https://www.webrtcserver.cn/ 服务器搭建环境各有不同在此参考前人经验差试一下. 运行AppRTC需要使用Google ...
- Git服务搭建及github使用教程
.pos { position: fixed; top: 35%; left: 90% } .pos a { border: 2px solid white; background: #99CCFF; ...
- WebRTC服务器——Licode 环境搭建
WebRTC服务器--Licode 环境搭建 系统配置 阿里云服务器 Ubuntu 14.04.5 LTS Docker 环境搭建 在一台空的机器上搭建docker环境,先要安装docker,执行下面 ...
- 简介vsftpd及搭建配置 关闭selinux 不能创建文件
简介vsftpd及搭建配置一.简介 FTP(文件传输协议)全称是:Very Secure FTP Server. Vsftpd是linux类操作系统上运行的ftp服务器软件. vsftp提供三种登陆方 ...
- 简介及环境搭建跑通Hello
简介及环境搭建跑通Hello Spring Spring是一个开放源代码的设计层面框架,他解决的是业务逻辑层和其他各层的松耦合问题,因此它将面向接口的编程思想贯穿整个系统应用.是为了解决企业应用程序开 ...
- linux之FTP服务搭建 ( ftp文件传输协议 VSFTPd虚拟用户)
FTP服务搭建 配置实验之前关闭防火墙 iptables -F iptables -X iptables -Z systemctl stop firewalld setenforce 0 1.ftp简 ...
- 3、dns服务搭建
3.1.dns服务简介: 1.DNS(Domain Name System)域名系统. 目前提供网络服务的应用使用唯一的32位的IP地址来标识,但是由于数字比较复杂.难以记忆,因此产生了域名系统(DN ...
- samba服务搭建及管理
关闭防火墙 # /etc/init.d/iptables stop # chkconfig --level iptables off 关闭SELINUX # vim /etc/sysconfig/se ...
- 《postfix MAIL服务搭建(第一篇):》RHEL6
初级篇:搭建发送端.接收端.邮件别名的添加从而达到邮件群发功能的实现. 我们都知道邮件服务器是2个服务端也就是说2个端口,一个是发送的端口,一个是收邮件的端口,我们平常所使用的发送,接收邮件的过程,只 ...
随机推荐
- Android Metro风格的Launcher开发系列第三篇
前言: 各位小伙伴,又到了每周更新文章了时候了,本来是周日能发出来呢,这不是赶上清明节吗,女王大人发话了,清明节前两天半陪她玩,只留给我周一下午半天时间写博客,哪里有女王哪里就有压迫呀有木有!好了闲话 ...
- python练习三—解析xml
使用python解析xml,主要使用sax的ContentHandler中的标签开始和标签结束的方法驱动,然后在开始(或者结束)事件中决定使用什么处理方法,使用dispatcher来决定并分发到指定方 ...
- MFC控件编程之鼠标跟键盘消息
MFC控件编程之鼠标跟键盘消息 在MFC中鼠标消息.键盘消息我们很常用.所以说一下. 鼠标消息分为客户区消息.跟非客户区消息. 一丶客户区消息 我们可以处理消息.来进行我们相应的函数即可. MFC添加 ...
- ES6 系列之我们来聊聊装饰器
Decorator 装饰器主要用于: 装饰类 装饰方法或属性 装饰类 @annotation class MyClass { } function annotation(target) { targe ...
- Perl包和模块(内容来自beginning perl)
单文件版的perl程序只能用于构建较小的脚本程序.当代码规模较大时,应该遵循下面两条规则来构建程序.这样能将程序的各个部分按功能一个一个地细化,便于维护,也便于后续开发. 能复用的代码放进函数 能复用 ...
- Docker介绍及常用操作演示(一)--技术流ken
Docker简介 Docker 是一个开源的应用容器引擎,让开发者可以打包他们的应用以及依赖包到一个可移植的容器中,然后发布到任何流行的Linux机器上,也可以实现虚拟化.容器是完全使用沙箱机制,相互 ...
- 分布式系统监视zabbix讲解六之自定义监控项--技术流ken
宏 概述 Zabbix支持许多在多种情况下使用宏.宏是一个变量,由如下特殊语法标识: {MACRO} 根据在上下文中, 宏解析为一个特殊的值. 有效地使用宏可以节省时间,并使Zabbix变地更加高效. ...
- [转][Angularjs]$http.post与$.post
本文转自:https://www.cnblogs.com/wolf-sun/p/6878868.html 摘要 在angularjs发送post请求的时候,确实很困惑,在传递json数据的时候,总会遇 ...
- WPF 故事版例子
Storyboard std = new Storyboard(); DoubleAnimation a = new DoubleAnimation(); a.From =0; a.To =400; ...
- C# winform程序怎么打包成安装项目(VS2010图解)
作为研发人员,在本机上开发的winform.wpf或者控制台程序需要发给其他人测试时候,一般需要对其进行打包生成setup安装文件,根据网上查找的资料并结合自己打包成功,记录如下: 注:本程序是一个利 ...