PhoneRTC演示应用程序

时间:2014-10-16 17:58:33

标签: node.js cordova phonertc

我正在尝试启动并运行PhoneRTC演示。 https://github.com/alongubkin/phonertc/

我实际上有一堆疑惑

首先,我的理解: 1.我们需要一个TURN服务器 我们需要一个信令服务器(repo中的演示/服务器) 3.我们需要一个使用phoneRTC项目的cordova项目(回购中的演示/客户端)

  1. 启动了AWS实例,分配了动态DNS。 安装了TURN服务器并启动它 - 但现在我对教程中提到的私有ip和公共ip部分感到困惑,因为每次重启实例时我的ip都会改变。我有一个dns名称(来自noip),它会坚持下去。所以我正在探索如何使用

  2. 设置TURN服务器
  3. 我检查了源代码,然后按照npm install cordva等步骤进行操作,

  4. 对于信令服务器,我在源代码中导航到demo / server并在npm install之后尝试了node index.js,但是找不到关于找不到模块的几个错误。

  5. demo / client也是一个nodeJS项目,对吧?如果我启动并运行,那就是视频聊天,对吗?

2 个答案:

答案 0 :(得分:4)

Amazon提供Elastic IPs,允许您为EC2主机创建永久IP地址。

以下是从头开始运行演示所需的完整命令:

# install global dependencies
npm install -g cordova bower grunt-cli

# clone phonertc
git clone https://github.com/alongubkin/phonertc.git

# build client
cd demo/client
npm install
bower install

cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.console
cordova plugin add https://github.com/alongubkin/phonertc.git

# follow the instructions for iOS after running this command
cordova platform add ios android  

# before running the next command, make sure to
# change your server details in demo/client/app/scripts/signaling.js 
# and in demo/client/app/scripts/CallCtrl.js 
grunt build --force

# build server
cd ../server
npm install

运行服务器:

cd demo/server
node index.js

在Android上运行客户端:

cordova run android

在iOS上运行客户端:

cordova build ios

在真正的iOS设备上运行Xcode项目。

答案 1 :(得分:4)

我启动并运行了演示,使用离子CLI执行后续步骤(Android):

# install global dependencies
npm install -g cordova bower grunt-cli

# Get a GIT clone, needed for copying files
git clone https://github.com/alongubkin/phonertc.git

# start new ionic project
ionic create phonertc-ionic
cd phonertc

# Copy files from GIT clone to your ionic project
cp -R phonertc-gitclone\demo\client\* phonertc-ionic\

# install dependencies
npm install
bower install

# install plugins
cordova plugin add org.apache.cordova.device
cordova plugin add org.apache.cordova.console
cordova plugin add https://github.com/alongubkin/phonertc.git

# add android platform
cordova platform add android

# install/running signaling server
cd phonertc-gitclone/demo/server
npm install
node index.js

# setting up turn server (not sure if needed)
# I installed it on a VirtualBox Ubuntu server, also see:
# https://github.com/alongubkin/phonertc/wiki/Installation
# Next ports should be open to your Ubuntu TURN server:
# TCP 443
# TCP 3478-3479
# TCP 32355-65535
# UDP 3478-3479
# UDP 32355-65535
sudo apt-get install rfc5766-turn-server
# Edit /etc/turnserver.conf and change:
listening-ip=<internal IP VirtualBox Ubuntu>
relay-ip=<internal IP VirtualBox Ubuntu>
external-ip=<internal IP VirtualBox Ubuntu>
min-port=32355 
max-port=65535
realm=<your domain>
# Also uncomment
lt-cred-mech
fingerprint
# Edit /etc/turnuserdb.conf and at the end, add:
username:password
# Start TURN server
sudo /etc/init.d/rfc5766-turn-server start

# before running the next command, make sure to
# change your server details in demo/client/app/scripts/signaling.js 
# and in demo/client/app/scripts/CallCtrl.js 
cd phonertc-ionic/
grunt build --force

# Copy files from phonertc-ionic app dir to www dir
cp -R phonertc-ionic/app/* phonertc-ionic/www/

# Build and run to android
ionic run android

注意:

用你的电话填写phonertc-ionic和phonertc-gitclone dirs。 此时我只能在2台Android设备之间进行测试。声音目前很糟糕,但视频很棒。 现在尝试在IOS上构建。