webRTC:一、房间服务器的搭建(综述)

来源:互联网 发布:智能电视哪个网络品牌 编辑:程序博客网 时间:2024/04/28 18:00

搭建目的:测试信令服务器功能 第一步搭建房间服务器

(本文前半部分是走的弯路,一些错误示范 后半部分才是对的)

服务器的代码我们选用GoogleChrome的开源项目,该项目可以在Github找到:

https://github.com/GoogleChrome/webrtc

 

来自 <http://webrtc.org.cn/webrtc_server/>

 

该项目的一些示例可以在下面网址得到:

https://github.com/GoogleChrome/webrtc

 

来自 <http://webrtc.org.cn/webrtc_server/>

 

在我们自己的服务器中运行Google的房间服务器AppRTC需要依赖Google App Engine SDK for Python 和 Grunt.

 

来自 <http://webrtc.org.cn/webrtc_server/>

 

Grunt:

javaScript 世界的构建工具

先搭建房间服务器AppRTC

  • 首先我们安装Grunt:

 

cheetah@localhost:~/$sudo apt-get install npm

cheetah@localhost:~/$sudo apt-get install nodejs-legacy

cheetah@localhost:~/$sudo npm -g install grunt-cli;

  • 下载该项目的源码到某个目录:

cheetah@localhost:~/$cd ~;

cheetah@localhost:~/$git clone https://github.com/GoogleChrome/webrtc.git;

 

终端Shell切换当前工作目录到上一步的下载的项

  • //目目录webrtc下,然后安装Grunt以及Grunt的依赖:

//cheetah@localhost:~/$ cd~;

//cheetah@localhost:~/$ gitclone https://github.com/GoogleChrome/webrtc.git;

  • 运行AppRTC房间服务器之前我们需要Grunt编译一下该项目的js文件之类:

cheetah@localhost:~/webrtcgrunt;

错误:

 Local Npm module"grunt-contrib-compress" not found. Is it installed?

>>Local Npm module "grunt-contrib-csslint" not found. Is it installed?

>>Local Npm module "grunt-eslint" not found. Is it installed?

>>Local Npm module "grunt-githooks" not found. Is it installed?

>>Local Npm module "grunt-htmlhint" not found. Is it installed?

Warning:Task "csslint" not found. Use --force to continue.

 

Aborteddue to warnings.

修复:

在webrtc目录下:

npminstall

 

 

上面的编译过程会自动下载安装GoogleApp Engine SDK至当前目录.(自己运行没有成功,在这里并没有自动下载)

cheetah@localhost:~/webrtc$ls

bower.jsongoogle_appengine Gruntfile.js LICENSE.md README.md samples

buildgoogle_appengine_1.9.17.zip images node_modules run_python_tests.pywebtest-master

CONTRIBUTING.mdgrunt-chrome-build index.html package.json run_python_tests.shwebtest-master.tar.gz

下一步,我们需要把Google App Engine SDK的目录加入系统环境变量$PATH,并使之生效.

cheetah@localhost:~/webrtc$echo “export PATH=$PATH:$PWD/google_appengine” > ~/.bash_profile

cheetah@localhost:~/webrtc$source ~/.bash_profile

这个时候我们就可以直接运行我们的房间服务器AppRTC了.用下面的命令来开启(主机名:vpn.wuqiong.tk可以用自己的给我钱IP地址代替):

cheetah@localhost:~/webrtcdev_appserver.py –hostvpn.wuqiong.tk  samples/web/content/apprtc/

 

 

按照上述方法失败了,不知道哪里出了问题

 

 

另寻他法:

Ubuntu翻墙

https://github.com/naseeihity/LearnReact/issues/7

 

 

git端口修改:

git config--globalhttp.proxy"localhost:1080"

 

来自 <http://www.eblogs.cn/git/165.html>

失败后改回:

 

gitconfig --global http.proxy "chromium.googlesource.com:443"

 

(失败)

如何修改git配置文件:失败

  删除git重装:

Ubuntu下彻底删除卸载某个软件

 

sudo apt-get –purge remove git

 

https://www.linuxdashen.com/debianubuntu%E6%B8%85%E7%90%86%E7%A1%AC%E7%9B%98%E7%A9%BA%E9%97%B4%E7%9A%848%E4%B8%AA%E6%8A%80%E5%B7%A7

 

Git的安装和配置

http://www.infoq.com/cn/news/2011/01/git-adventures-install-config

 

 

卸载重装设置仍在

 

彻底解决:

git config --global https.proxy http://127.0.0.1:1080

 

 

git config --global https.proxy https://127.0.0.1:1080

 

git config --global --unset http.proxy

 

git config --global --unset https.proxy

 

npm config delete proxy

 

来自 <https://gist.github.com/laispace/666dd7b27e9116faece6>

如何去除Git代理

1. git config --global -e

 

来自 <http://www.jianshu.com/p/b2f4df042e62>

 

 

http://io.diveinedu.com/2016/03/18/WebRTC%E4%B9%8BAppRTC%E4%B8%8E%E4%BF%A1%E4%BB%A4%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%9E%84%E5%BB%BA.html

然后再执行下面命令编译出apprtc这个GAE app.

执行到这里出错  依然没有

编译完成后,输出将放在~/apprtc_root/out目录下的app_engine目录

 

来自 <http://io.diveinedu.com/2016/03/18/WebRTC%E4%B9%8BAppRTC%E4%B8%8E%E4%BF%A1%E4%BB%A4%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%9E%84%E5%BB%BA.html>

 

没有out 文件夹

 

要检查特定的包,比如firefox是否安装了,使用这个命令:

  1. dpkg -s firefox

 

来自 <http://www.linuxidc.com/Linux/2015-03/115605.htm>

 

网贴害死人啊,特别看上去很正规的,其实很多错误!!

 

最后一次尝试:

http://www.jb51.net/article/90518.htm

结合

http://blog.csdn.net/u014190646/article/details/51210606

以及:

http://io.diveinedu.com/2016/03/18/WebRTC%E4%B9%8BAppRTC%E4%B8%8E%E4%BF%A1%E4%BB%A4%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%9E%84%E5%BB%BA.html

注:先根据第二个链接安装 Google App Engine SDK for Python

然后用第一个链接完成Node.js与npm的安装

然后根据第二个链接2-4进行依赖的安装

在编辑和运行时注意:

Grunt build时不能用root用户 否则会无休止的编译(我的跑了10分钟被我关了)

启动apprtc时要将dev_appserver.py配置到环境变量中。

exportPATH=$PATH:/usr/local/google_appengine

执行

dev_appserver.py./out/app_engine

命令时需在out目录之外 

 

 

 

 

 

 

运行成功截图:

 

 


找一现成webrtc试一下:房间服务器建成之前:


房间服务器建成之后:

 

原创粉丝点击