zoro

编风网(www.befo.io)

  • 博客访问: 1062303
  • 博文数量: 200
  • 博客积分: 3308
  • 博客等级: 中校
  • 技术积分: 2231
  • 用 户 组: 普通用户
  • 注册时间: 2010-10-03 12:03
  • 认证徽章:
个人简介

我是zoro

文章分类

全部博文(200)

文章存档

2015年(1)

2013年(45)

2012年(44)

2011年(50)

2010年(60)

微信关注

IT168企业级官微



微信号:IT168qiye



系统架构师大会



微信号:SACC2013

订阅
热词专题
WebRTC学习笔记 2013-10-25 08:44:06

分类: Web开发

<h1 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:41.818180084228516px;"> <a name="_Toc353542667"></a><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;"><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;"><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;">1.<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span>&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;">WebRTC</span></span><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;"><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;"><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;font-family:黑体;">学习</span></span></span><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;"><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;"></span></span> </h1> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:30.909090042114258px;"> <span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><a name="_Toc353542668"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">1.1<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span>&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">WebRTC</span></span><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;font-family:黑体;">现状</span></span></span> </h2> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">本人最早接触<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>是在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">2011</span>年底,那时<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Google</span>已经在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Android</span>源码中加入了<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">webrtc</span>源码,放在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">/external/webrtc/</span>,但是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Android</span>并没有用到它,更没有被浏览器使用。当时试图在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Android 2.3</span>(<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Gingerbread</span>)高通平台的手机上用<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">H.264</span>&nbsp;硬件<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">codec</span>替换掉<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>缺省使用的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">VP8</span>软<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">codec</span>,费了不少劲勉强换掉后效果很差只得放弃。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">最近得知<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Google</span>最新版的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome for Android</span>已经支持<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>,应老板的要求搭一个手机浏览器上视频通信的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>,为此在网上搜集各种资料,发现经过一年多的发展,国内外研究和使用<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>的人明显多起来,可用的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>也很多。在此做一个笔记,留作日后参考。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">目前基于<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>的开发其实有两个方向,一个是基于浏览器的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>应用开发,编程语言主要是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">JavaScript</span>、<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">HTML</span>等,这也是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>作为<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">HTML5</span>标准的组成部分原本的目的;另一个是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">C</span>层面的移植和开发,作为一款非常强大的开源软件,很多领域的软件项目都可以利用到<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>的音视频通信和处理能力,这些场合的应用程序可能是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">C</span>语言写的,也不一定与浏览器有关。本文是属于前一种方向,后一种方式详见<span style="color:#494949;font-family:宋体;font-size:13.63636302948px;line-height:20px;text-indent:28px;white-space:normal;background-color:#C1CFD0;"><a href="http://www.cnblogs.com/lingyunhu/" target="_blank">http://www.cnblogs.com/lingyunhu/</a></span>。</span> </p> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:30.909090042114258px;"> <a name="_Toc353542669"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">1.2<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span>&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">WebRTC</span><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;font-family:黑体;">基本概念学习</span></span> </h2> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">WebRTC</span><span style="word-wrap:normal;word-break:normal;font-family:宋体;">的官方资料可以从其官网<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="http://www.webrtc.org/" style="text-decoration:none;color:#566053;">http://www.webrtc.org/</a></span>和<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">W 3C</span>网站<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="http://www.w3.org/TR/webrtc/" style="text-decoration:none;color:#566053;">http://www.w3.org/TR/webrtc/</a></span>上看到。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">学习<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>基础知识比较好的网站是《<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Getting Started with WebRTC</span>》,网址是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="http://www.html5rocks.com/en/tutorials/webrtc/basics/" style="text-decoration:none;color:#566053;">http://www.html5rocks.com/en/tutorials/webrtc/basics/</a></span>,这个也是官网上推荐的。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">对浏览器来说,<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>其实就是提供了<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">3</span>个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">API</span>:</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;text-indent:21pt;background-color:#E0E0E0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">MediaStream (</span><span style="word-wrap:normal;word-break:normal;font-family:宋体;">即<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">getUserMedia)</span>,用于获取媒体数据,例如来自摄像头和麦克风的视频流和音频流;</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;text-indent:21pt;background-color:#E0E0E0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">RTCPeerConnection</span><span style="word-wrap:normal;word-break:normal;font-family:宋体;">,用于<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>跟<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>之间呼叫和建立连接以便传输音视频数据流;</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;text-indent:21pt;background-color:#E0E0E0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">RTCDataChannel</span><span style="word-wrap:normal;word-break:normal;font-family:宋体;">,用于<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>跟<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>之间传输音视频之外的一般数据。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">需要注意的是这几个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">API</span>的名称在不同浏览器及同一浏览器的不同版本之间略有差异,比如<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">PeerConnection</span>在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">FireFox</span>上叫做<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">mozRTCPeerConnection</span>,而在当前版本的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome</span>上叫做<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">webkitRTCPeerConnection</span>,将来<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>标准化完成后会把这些前缀去掉使用统一的名称。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">目前网上找到的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC demo</span>都只用到了<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">getUserMedia</span>和<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">RTCPeerConnection</span>这两个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">API</span>,另一个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">API</span>即<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">RTCDataChannel</span>似乎目前还不太成熟。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">WebRTC</span><span style="word-wrap:normal;word-break:normal;font-family:宋体;">是实现<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer to peer</span>的实时通信(可以两个或多个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>之间),在能够通信前<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>跟<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>之间必须建立连接,这是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">RTCPeerConnection</span>的任务,为此需要借助一个信令服务器(<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">signaling server</span>)来进行,信令包括<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">3</span>种类型的信息:</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;text-indent:21pt;background-color:#E0E0E0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">Session control messages:</span>&nbsp;<span style="word-wrap:normal;word-break:normal;font-family:宋体;">初始化和关闭通信,及报告错误;</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;text-indent:21pt;background-color:#E0E0E0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">Network configuration:</span>&nbsp;<span style="word-wrap:normal;word-break:normal;font-family:宋体;">双方的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">IP</span>地址和端口号(局域网内部<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">IP</span>地址需转换为外部的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">IP</span>地址);</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;text-indent:21pt;background-color:#E0E0E0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">Media capabilities:</span>&nbsp;<span style="word-wrap:normal;word-break:normal;font-family:宋体;">双方的浏览器支持使用何种<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">codecs</span>以及多高的视频分辨率。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">WebRTC</span><span style="word-wrap:normal;word-break:normal;font-family:宋体;">并未规定使用何种信令机制和消息协议,象<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">SIP</span>、<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">XMPP</span>、<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">XHR</span>、<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebSocket</span>这些技术都可以用作<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>的信令通信。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">除了信令服务器,<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>跟<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>建立连接还需要借助另一种服务器(称为<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">STUN server</span>)实现<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">NAT/Firewall</span>穿越,因为很多<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>是处于私有局域网中,使用私有<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">IP</span>地址,必须转换为公有<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">IP</span>地址才能相互之间传输数据。这其中涉及到一些专业术语包括<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">STUN</span>、<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">TURN</span>、<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">ICE</span>等,具体的本人还有待学习。网上找到的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC demo</span>好象都用的是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Google</span>提供的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">STUN server</span>。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">peer</span><span style="word-wrap:normal;word-break:normal;font-family:宋体;">跟<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>之间一旦建立连接就可以直接传输音视频数据流,并不需要借助第三方服务器中转。</span> </p> <h1 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:41.818180084228516px;"> <a name="_Toc353542670"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;"><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;">2.<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span>&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;">WebRTC</span><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;"><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;font-family:黑体;">封装库</span></span> </h1> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">WebRTC</span><span style="word-wrap:normal;word-break:normal;font-family:宋体;">的目的是为了简化基于浏览器的实时数据通信的开发工作量,但实际应用编程还是有点复杂,尤其调用<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">RTCPeerConnection</span>必须对如何建立连接、交换信令的流程和细节有较深入的理解。因此有高人为我们开发了<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>封装库,将<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>的调用细节封装起来,包装成更简单的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">API</span>,使开发应用程序更简单。封装库的另一个目的是为了屏蔽不同浏览器之间的差异,例如上面说的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">API</span>名称的差异。当然,这些库都是开源的,可以根据自己的需要重新修改。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">目前网上找到的有两种<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>封装库,一个是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">webrtc.io</span>,网址是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="https://github.com/webRTC/webRTC.io" style="text-decoration:none;color:#566053;">https://github.com/webRTC/webRTC.io</a></span>,上面有详细说明和使用方法,有很多<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>使用它;另一个是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">SimpleWebRTC</span>,网址是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="https://github.com/HenrikJoreteg/SimpleWebRTC" style="text-decoration:none;color:#566053;">https://github.com/HenrikJoreteg/SimpleWebRTC</a></span>,貌似比<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">webrtc.io</span>用起来更简单。</span> </p> <h1 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:41.818180084228516px;"> <a name="_Toc353542671"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;"><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;">3.<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span>&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;">WebRTC demo</span><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;"><span style="word-wrap:normal;word-break:normal;line-height:41.818180084228516px;font-family:黑体;">试用</span></span> </h1> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">网上可以找到一堆<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC demo</span>,在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">code.google.com</span>上也能找到不少<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>应用项目的源码。有些<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>是直接调用<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC API</span>开发的,但大多数是调用上述两种<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>封装库开发的。由于<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC API</span>的名称在不同浏览器及同一浏览器的不同版本之间存在差异,所以不是所有<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>都能运行在所有浏览器上。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">为了找到一个可在公司局域网环境中跑在手机上的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC demo</span>,本人试用了不少<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>,下面选几个有代表性的介绍,其中有两个经修改后已在本人公司的局域网环境中运行成功。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">先说一下本人的测试环境:手机上的浏览器是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome for Android 26.0.1410.49</span>,运行在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Android 4.1.2</span>上,这个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome</span>版本本身是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">beta</span>版,支持<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>但缺省是关闭<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>功能的,需要在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">chrome://flags</span>中使能<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>并重启<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome</span>,或者在启动<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome</span>时增加命令行选项<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">--enable-webrtc</span>。本人在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">PC</span>上运行<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>的浏览器是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome 26.0.1410.43</span>,操作系统是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Windows 7</span>。<br /> &nbsp; &nbsp; &nbsp; &nbsp; 这个demo现在已经没有视频功能了,只有音频功能,因为google已经慢慢标准化webrtc的使用方法了。</span> </p> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:30.909090042114258px;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">3.1<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><a href="http://www.webrtc.org/demo" style="text-decoration:none;color:#566053;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">http://www.webrtc.org/demo</span></a><a name="_Toc353542672"></a></span><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;font-family:黑体;">(</span><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">https://apprtc.appspot.com/</span></span><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;font-family:黑体;">)</span></span> </h2> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">这是官方的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>,功能很全,不过需要翻墙才能访问<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="https://apprtc.appspot.com/" style="text-decoration:none;color:#566053;">https://apprtc.appspot.com</a></span>,不过其源码还是可以下载到的,在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="https://code.google.com/p/webrtc-samples/" style="text-decoration:none;color:#566053;">https://code.google.com/p/webrtc-samples/</a></span>。此<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>没有用任何封装库。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">这个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>所使用的信令机制使用了<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">XHR</span>和<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Google App Engine Channel API</span>&nbsp;,说白了就是google再给自家产品打广告,不然不会搞这么复杂。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">貌似http://www.cnblogs.com/lingyunhu/移植和优化了安卓,ios,pc的整套东西,有兴趣的可以直接去问他。<br /> </span> </p> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:30.909090042114258px;"> <a name="_Toc353542673"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">3.2<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span>&nbsp;<span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;font-family:黑体;">爱立信实验室开发的</span><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">WebRTC demo</span> </h2> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">据说是第一个基于浏览器的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>视频通信<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>,爱立信为此还开发了一个浏览器用于支持<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>,好象也是基于<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebKit</span>的,叫做<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Bowser browser</span>(当时市场上可能还没有支持<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>的浏览器),该项目网址是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="https://labs.ericsson.com/apps/bowser" style="text-decoration:none;color:#566053;">https://labs.ericsson.com/apps/bowser</a></span>。这个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Bowser browser</span>好象只支持<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Ubuntu 11.04 and 11.10</span>(见<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="https://labs.ericsson.com/apis/web-real-time-communication/downloads" style="text-decoration:none;color:#566053;">https://labs.ericsson.com/apis/web-real-time-communication/downloads</a></span>)。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">该<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>的网址是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="http://webrtc.labs.ericsson.net:8082/" style="text-decoration:none;color:#566053;">http://webrtc.labs.ericsson.net:8082</a></span>。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">在我的公司局域网环境里无法运行该<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>。</span> </p> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:30.909090042114258px;"> <a name="_Toc353542674"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">3.3<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span>&nbsp;<span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;font-family:黑体;">人脸检测识别</span> </h2> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">利用<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">getUserMedia</span>从摄像头获取图像进行人脸识别的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>,例如这两个:</span> </p> <p style="margin-top:0px;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;"><a href="http://neave.com/webcam/html5/face/" style="text-decoration:none;color:#566053;">http://neave.com/webcam/html5/face/</a></span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;"><a href="http://www.raymondcamden.com/demos/2012/mar/29/test1.html" style="text-decoration:none;color:#566053;">http://www.raymondcamden.com/demos/2012/mar/29/test1.html</a></span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">这两个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">PC</span>和手机上的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome</span>上都可运行。</span> </p> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:30.909090042114258px;"> <a name="_Toc353542675"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">3.4<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span>&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">http://www.simpl.info</span> </h2> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">这个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>演示<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">HTML, CSS and JavaScript</span>的各种<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">feature</span>和使用方法,包括<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">3</span>个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">API</span>:<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">getUserMedia</span>、<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">RTCPeerConnection</span>、<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">RTCDataChannel</span>的演示,但遗憾的是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">RTCPeerConnection</span>的演示只是本地<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">camera</span>的画面传回给本地,并没有实现真正的设备之间音视频通信。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">该项目的源码在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="https://github.com/samdutton/simpl" style="text-decoration:none;color:#566053;">https://github.com/samdutton/simpl</a></span>。</span> </p> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:30.909090042114258px;"> <a name="_Toc353542676"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">3.5<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span>&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">Framegrabber</span> </h2> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">这是一个基于<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebRTC</span>实现屏幕共享(<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">screensharing</span>)的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome</span>扩展,源码在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="https://github.com/samdutton/rtcshare" style="text-decoration:none;color:#566053;">https://github.com/samdutton/rtcshare</a></span>,有关介绍可参考这篇文章:<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="http://blog.sina.com.cn/s/blog_51396f890102es7k.html" style="text-decoration:none;color:#566053;">http://blog.sina.com.cn/s/blog_51396f890102es7k.html</a></span>。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">本人没有试用过。</span> </p> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:30.909090042114258px;"> <a name="_Toc353542677"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">3.6<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span>&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">http://webrtc.dennis.is</span> </h2> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">这个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>是基于库<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">webrtc.io</span>实现的,是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">webrtc.io</span>官方的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>,使用<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebSocket</span>作为信令手段。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">在我的公司局域网环境里无法运行该<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>;在家里无线路由器环境下可成功运行,但只能单向传输视频。</span> </p> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:30.909090042114258px;"> <a name="_Toc353542678"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;"><span style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">3.7<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span>&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.909090042114258px;">http://v.kainy.cn</span> </h2> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">国内牛人做的,相当于是汉化版的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="http://webrtc.dennis.is/" style="text-decoration:none;color:#566053;">http://webrtc.dennis.is</a></span>,自然也是基于<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">webrtc.io</span>实现的,但使用的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">webrtc.io</span>版本较老,不支持新版本<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome</span>所使用的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">API</span>名称<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">webkitRTCPeerConnection</span>,所以无法在新版本<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome</span>上运行。具体介绍在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="http://blog.kainy.cn/2013/01/webrtc%E5%AE%9E%E7%8E%B0%E7%9A%84%E8%A7%86%E9%A2%91%E8%81%8A%E5%A4%A9%E5%AE%A4%E5%BA%94%E7%94%A8/" style="text-decoration:none;color:#566053;">http://blog.kainy.cn/2013/01/webrtc<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">实现的视频聊天室应用/</span></span></a></span>。</span> </p> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;font-family:simsun;text-indent:0cm;white-space:normal;background-color:#C1CFD0;line-height:30.909090042114258px;"> <a name="_Toc353542679"></a><span lang="EN-US" xml:lang="EN-US" style="line-height:30.9090900421143px;text-indent:0cm;font-size:16px;font-weight:normal;word-wrap:normal;word-break:normal;"><span style="word-wrap:normal;word-break:normal;">3.8<span style="word-wrap:normal;word-break:normal;line-height:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span><span style="line-height:30.9090900421143px;text-indent:0cm;font-size:16px;font-weight:normal;">&nbsp;</span><span lang="EN-US" xml:lang="EN-US" style="line-height:30.9090900421143px;text-indent:0cm;font-size:16px;font-weight:normal;word-wrap:normal;word-break:normal;">http://conversat.io</span> </h2> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">这个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>是基于库<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">SimpleWebRTC</span>实现的,是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">SimpleWebRTC</span>官方的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>,使用<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebSocket</span>作为信令手段。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">在我的公司局域网环境里无法运行该<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">demo</span>;在家里无线路由器环境下可成功运行,且可双向传视频,支持多个<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">peer</span>同时视频通信。</span> </p> <p style="margin-top:0px;margin-bottom:6pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:21pt;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">经修改后在本人公司局域网成功运行,试过两个手机和一个笔记本电脑同时视频通信<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">OK</span>。修改和运行步骤:</span> </p> <p style="margin:0cm 0cm 6pt 39pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:-18pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;"><span style="word-wrap:normal;word-break:normal;">1.<span style="word-wrap:normal;word-break:normal;line-height:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span>&nbsp;<span style="word-wrap:normal;word-break:normal;font-family:宋体;">从<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">http://www.nodejs.org/download/</span>下载<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">nodejs</span>最新版并安装,我是在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Windows7 64</span>位上安装的;</span> </p> <p style="margin:0cm 0cm 6pt 39pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:-18pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;"><span style="word-wrap:normal;word-break:normal;">2.<span style="word-wrap:normal;word-break:normal;line-height:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span>&nbsp;<span style="word-wrap:normal;word-break:normal;font-family:宋体;">在命令行下依次运行如下命令(安装运行<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">signaling server</span>所需的模块):</span> </p> <p style="margin-top:0px;margin-left:42pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">npm install express</span> </p> <p style="margin-top:0px;margin-left:42pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">npm install yetify</span> </p> <p style="margin-top:0px;margin-left:42pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">npm install getconfig</span> </p> <p style="margin-top:0px;margin-left:42pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">npm install node-uuid</span> </p> <p style="margin:0cm 0cm 6pt 42pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;">npm install socket.io</span> </p> <p style="margin:0cm 0cm 6pt 39pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:-18pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;"><span style="word-wrap:normal;word-break:normal;">3.<span style="word-wrap:normal;word-break:normal;line-height:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span>&nbsp;<span style="word-wrap:normal;word-break:normal;font-family:宋体;">从<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">https://github.com/andyet/signalmaster</span>下载信令服务器源码,该信令服务器是<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">SimpleWebRTC</span>缺省使用的,解开该源码后运行<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">node server.js</span>,该服务器监听<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">8888</span>端口,通过<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">WebSocket</span>与浏览器通信。</span> </p> <p style="margin:0cm 0cm 6pt 39pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:-18pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;"><span style="word-wrap:normal;word-break:normal;">4.<span style="word-wrap:normal;word-break:normal;line-height:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span>&nbsp;<span style="word-wrap:normal;word-break:normal;font-family:宋体;">在同一台<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">PC</span>上运行<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">apache server</span>,将从<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="http://conversat.xn--ioserver-v39lz9evvo6p4c56hf3a38rv11etnpl4sju8c/" style="text-decoration:none;color:#566053;"><span style="word-wrap:normal;word-break:normal;color:windowtext;">http://conversat.io</span><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;color:windowtext;"><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">网站扒下来的文件放到该server</span></span></a></span>上(可在<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome</span>浏览器中打开<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="http://conversat.io/" style="text-decoration:none;color:#566053;">http://conversat.io</a></span>然后鼠标右键单击在菜单中选“另存为”、“网页,全部”即可),修改其中的&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">index.html</span>&nbsp;和&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">simplewebrtc.js</span>,将其中&nbsp;<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">url</span>&nbsp;改为<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">'http://10.100.156.83:8888'</span>(其中<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">IP</span>地址是我的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">PC</span>在公司局域网中的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">IP</span>地址)。</span> </p> <p style="margin:0cm 0cm 6pt 39pt;border:0px;list-style:none;word-wrap:normal;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302947998px;white-space:normal;background-color:#C1CFD0;text-indent:-18pt;"> <span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;font-family:宋体;"><span style="word-wrap:normal;word-break:normal;">5.<span style="word-wrap:normal;word-break:normal;line-height:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;&nbsp;&nbsp;</span></span></span>&nbsp;<span style="word-wrap:normal;word-break:normal;font-family:宋体;">在同一局域网中的其他设备上打开<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">Chrome</span>浏览器,地址栏输入<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;"><a href="http://10.100.156.83/" style="text-decoration:none;color:#566053;">http://10.100.156.83</a></span>,输入相同的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">room</span>名称(随便起)即可开始多方视频通信,也可修改上述<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">index.html</span>中的“<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">var room</span>”一行,设定为固定的<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">room</span>名称,就不需要每次在每个设备上手工输入<span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;">room</span>名称了。</span> </p> <h2 style="margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;text-indent:0cm;white-space:normal;line-height:30.9090900421143px;background-color:#C1CFD0;"> <h2 style="text-indent:0cm;white-space:normal;margin:0px 0px 0px 0cm;padding:0px;border:0px;list-style:none;color:#494949;line-height:30.9090900421143px;background-color:#C1CFD0;"> <span style="font-family:simsun;"><a name="_Toc353542680"></a><span lang="EN-US" xml:lang="EN-US" style="word-wrap:normal;word-break:normal;line-height:30.9090900421143px;"><span style="word-wrap:normal;word-break:normal;line-height:30.9090900421143px;">3.9<span style="word-wrap:normal;word-break:normal;line-height:normal;font-weight:normal;font-size:7pt;font-family:'Times new roman';">&nbsp;&nbsp;</span></span></span>&nbsp;</span><span style="font-family:黑体;"><a href="http://www.rtc.help" target="_blank">http://www.rtc.help</a></span> </h2> <p style="word-wrap:normal;margin-top:0px;margin-bottom:6pt;white-space:normal;border:0px;list-style:none;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302948px;text-indent:21pt;background-color:#C1CFD0;"> <span style="font-family:宋体;font-size:13.63636302948px;text-indent:-18pt;"></span> </p> <p style="word-wrap:normal;margin-top:0px;margin-bottom:6pt;white-space:normal;border:0px;list-style:none;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302948px;text-indent:21pt;background-color:#C1CFD0;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">这是一群牛人组成的团队,你想要的服务他们都可以提供,不过估计有些服务是收费的,因为天下没有免费午餐。</span> </p> <p style="word-wrap:normal;margin-top:0px;margin-bottom:6pt;white-space:normal;border:0px;list-style:none;word-break:normal;line-height:20px;color:#494949;font-family:simsun;font-size:13.63636302948px;text-indent:21pt;background-color:#C1CFD0;"> <span style="word-wrap:normal;word-break:normal;font-family:宋体;">里面也有他们的博客和联系方式,他们应该做的是全国各地的业务,有兴趣可以直接跟他们联系</span><span style="font-family:宋体;font-size:13.63636302948px;text-indent:-18pt;"></span><span style="font-family:宋体;font-size:13.63636302948px;text-indent:-18pt;">。</span> </p> <div> <br /> </div> <br /> </h2>
阅读(59008) | 评论(3) | 转发(2) |
给主人留下些什么吧!~~

suiyuemanbu2015-01-29 11:45:10

写的太好了

jinglier2014-01-22 13:43:04

非常感谢

jinglier2014-01-22 13:41:54

你好,我试了你说的最后一种方法,但是node app.js的时候总是提示:
Start listening on port 8000

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EADDRINUSE
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1039:14)
    at listen (net.js:1061:10)
  &n

评论热议
请登录后评论。

登录 注册