webrtc的DEMO环境搭建

Webrtc 介绍与Demo环境搭建

一,webrtc的基本介绍

WebRTC是一个开源项目,提供简单的JavaScript接口以实现浏览器的实时通信(RTC)。与普通的客户端与服务器之间的即时通信不同,webrtc通过一系列的信令,能建立起一个浏览器与浏览器之间(peer-to-peer)的信道,这个信道可以发送任何数据,包括音视频数据,而不需要经过服务器。

WebRTC通过实现MediaStream,调用设备的摄像头、话筒,使得浏览器之间可以传递音频和视频

 

WebRTC applications need to do several things:

   * Get streamingaudio, video or other data.

   * Get networkinformation such as IP addresses and ports, and exchange this with other WebRTCclients (known as peers) to enable connection, even through NATs and firewalls.

   * Coordinatesignaling communication to report errors and initiate or close sessions.

   * Exchangeinformation about media and client capability, such as resolution and codecs.

   * Communicate streamingaudio, video or data.

 

To acquire and communicate streaming data, WebRTCimplements the following 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 andbandwidth management.

   * RTCDataChannel:peer-to-peer communication of generic data.

 

现在WebRTC已经可以在较新版的Chrome、Opera和Firefox中使用了,著名的浏览器兼容性查询网站caniuse上给出了一份详尽的浏览器兼容情况。国内大部分主流浏览器都支持(如:360极速浏览器,傲游,搜狗等)。

支持的操作系统平台有:ios, android。

 

https://webrtc.org/start/开始认识webrtc.

 

网络拓扑图:


上面是一个简单的webrtc系统网络拓扑图,其中链路1表示终端从服务器上获取前端页面;链路2表示信令交互过程;链路3表示NAT穿透过程;链路4是终端数据交互。

 

二,  webrtc的信令框架

1)  Whatis signaling?

WebRTC uses RTCPeerConnection to communicate streamingdata between browsers, but also needs a mechanism to coordinate communicationand to send control messages, a process known as signaling. Signaling methodsand protocols are not specified by WebRTC.

Instead, WebRTC app developers can choose whatevermessaging protocol they prefer, such as SIP or XMPP, and any appropriate duplex(two-way) communication channel. The apprtc.appspot.com example usesXHR and the Channel API as the signaling mechanism. The codelab webuilt uses Socket.io runningon a Node server.

WEBRTC支持点对点数据通讯,但仍然需要服务端来协调双方的信令消息。在Webrtc规范中未定义信令相关的方法和协议,也就是说信令服务器和控制机制是由应用开发者来自已定义和实现。

至于为什么对信令机制不作定义,有以下的解释:

Why is signaling not defined by WebRTC?

To avoidredundancy and to maximize compatibility with established technologies,signaling methods and protocols are not specified by WebRTC standards.

 

2)  What does signaling do?

Signaling is used to exchange three types of information:

* Session control messages: to initialize or closecommunication and report errors.

* Network configuration: to the outside world, what's mycomputer's IP address and port?

* Media capabilities: what codecs and resolutions can behandled by my browser and the browser i

  • 3
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
WebRTC Demo是一种在线应用程序,它基于WebRTC技术,能够通过网络实时传输音频、视频和数据。WebRTC是一种开放性的标准,旨在使浏览器成为实时通信的平台,而不需要安装额外的插件或软件。 通过WebRTC Demo,用户可以利用网络直接进行语音和视频通话,而无需使用传统的电话线路。此外,它还提供了实时数据传输的功能,使用户能够共享文件、屏幕或其他类型的数据。 WebRTC Demo的工作原理是基于P2P(点对点)连接。它使用STUN(Session Traversal Utilities for NAT)和TURN(Traversal Using Relays around NAT)协议来处理网络的穿透和转发。这样,用户可以建立直接的连接,实现快速稳定的通信。 WebRTC Demo可以应用于多种场景,如在线会议、远程教育、客户服务等。它为用户提供了方便快捷的实时通信方式,无论是个人用户还是企业用户,都可以从中受益。 WebRTC Demo还具有跨平台的特性,可以在不同的设备上运行,包括桌面、移动端和嵌入式设备。用户可以在智能手机、平板电脑或计算机上使用WebRTC Demo,随时随地与其他人进行通信。 总之,WebRTC Demo是一种能够实现在线实时通信的应用程序,它利用WebRTC技术提供了音频、视频和数据传输的能力,为用户提供了方便快捷的通信方式。无论是个人用户还是企业用户,都可以通过WebRTC Demo实现在线的语音、视频通话和数据共享。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值