webrtc谷歌官方版本编译过程
ubuntu系统环境:
nodejs npm go 最好都需要下载最新版本源码,再编译安装,版本如下:
dl@dl2:~$ go version
go version go1.10.1 linux/amd64
dl@dl2:~$ npm -v
5.8.0
dl@dl2:~$ node -v
v9.11.1
注意:设置的环境变量GOPATH和GOROOT不能相同!
export GOPATH=$HOME/goWorkspace
export GOROOT=/usr/local/go
export GOAPPENG=/home/dl/goWorkspace/google_appengine
export PATH=$PATH:$GOAPPENG:$GOROOT/bin
python2.7 需要添加sqlite3重新编译
./configure LDFLAGS='-L/home/dl/sqlite_source/.libs' CPPFLAGS='-I/home/dl/sqlite_source' --enable-optimizations
服务器
- 房间服务器 apprtc
- 信令服务器 collidmain 源码再apprtc中
- turn服务器 coturn
依赖的谷歌专属包:google_appengine,加入到环境变量/etc/profile中:
export PATH="$PATH:/home/dl/goWorkspace/google_appengine/"
- nginx服务器:
upstream roomserver {
server 192.168.1.140:8080;
}
server {
listen 80 ;
server_name webrtc.eotu.com 192.168.1.140;
return 301 https://$server_name$request_uri;
}
server {
listen 443;
server_name webrtc.eotu.com 192.168.1.140;
location / {
proxy_pass http://roomserver$request_uri;
proxy_set_header Host $host;
}
location ~ \.php$ {
root /var/www/html;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.1-fpm.sock;
}
}
遇到的问题:
- 进入房间,一定要走https,否则浏览器没有权限打开摄像头等外设,所以使用nginx中转
- collider服务器走https有问题,待解决,http ok
2018/04/24 11:38:39 Added client 37096029 to room 11111
2018/04/24 11:38:39 Client 37096029 registered in room 11111