您的位置:首页 > 移动开发

webrtc 服务器搭建(1)apprtc房间服务器

2017-09-22 16:59 316 查看
ubuntu 14.04 64位

python 2.7.6

npm 5.4.2

node/nodejs v8.5.0

配置apprtc一切以官方配置为准:https://github.com/webrtc/apprtc

安装好jdk并配置好jdk环境变量

sudo
apt-get install openjdk-7-jdk

安装python-webtest

sudo
apt-get install python-webtest

安装nodejs编译管理库npm

sudo
apt-get install npm

安装各种包

由于npm是连接国外会很慢,建议设置使用淘宝镜像

npm config set registry https://registry.npm.taobao.org 
sudo
apt-get install nodejs

sudo
npm install -g npm

sudo
apt-get install nodejs-legacy

sudo
npm -g install grunt-cli

ps:

如果sudo
npm install -g npm

弹出:ERROR:
npm is known not to run on Node.js v0.10.25 需要升级至 4.x以上版本用以下方法解决

curl
-sL https://deb.nodesource.com/setup_8.x | sudo -E bash -

sudo
apt-get install -y nodejs

下载Google App Engine SDK for  Python 需翻墙

https://cloud.google.com/appengine/docs/standard/python/download



下载完之后注意配置环境变量



接下来修改apprtc/src/app_engine/constants配置文件



如果需要配置stun和turn服务器就将这段代码的注释去掉

网上有免费stun、turn服务器,后面也会实现搭建

TURN_SERVER_OVERRIDE = [
{
"urls": [
"turn:hostnameForYourTurnServer:19305?transport=udp",
"turn:hostnameForYourTurnServer:19305?transport=tcp"
],
"username": "TurnServerUsername",
"credential": "TurnServerCredentials"
},
{
"urls": [
"stun:hostnameForYourStunServer:19302"
]
}
]


当前只配置apprtc所以不将注释打开

接下来设置:TURN_BASE_URL='192.168.1.113'
//这是我的本地ip地址

CEOD_KEY暂时不设置,后面stun服务器需要在配置

ICE_SERVER_BASE_URL='192.168.1.113'

WSS_INSTANCE_HOST_KEY=
'192.168.1.113'

运行grunt
build

如果报ssl错误可以暂时不管,运行
grunt --force 继续

sudo
你的google appengine根目录/dev_appserver.py ./out/app_engine 这里需要翻墙才能运行成功

之后会生成out目录

localhost:8080如果出来画面就是成功了

===============================================================================================

今晚继续更新 2017/9/22
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  webrtc