ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] github:[https://github.com/open-webrtc-toolkit/owt-server](https://github.com/open-webrtc-toolkit/owt-server) 参考链接:[https://blog.piasy.com/2019/04/14/OWT-Server-Quick-Start/index.html](https://blog.piasy.com/2019/04/14/OWT-Server-Quick-Start/index.html) 参考链接:[https://blog.csdn.net/impingo/article/details/104344621](https://blog.csdn.net/impingo/article/details/104344621) 参考链接:[https://www.cnblogs.com/GuoXinxin/p/11162581.html](https://www.cnblogs.com/GuoXinxin/p/11162581.html) ## 概述 owt是一套完整的webrtc视频会议系统。包含的功能模块有: 1. 视频会议 2. p2p 服务器是owt-server通过nodejs编写的webrtc信令。依赖是licode。licode依赖webrtc。 客户端系列web/windows/linux/ios/android都有相应的sdk。 ## OWT Server 源码编译、部署 1. Ubuntu 18.04 2. CentOS 7.6 ## 安装 nodejs 环境 ``` apt-get install nodejs npm -y ``` ## 下载源码 ``` apt-get update && apt-get install -y git htop unzip make wget unzip\ && git config --global user.name z \ && git config --global user.email 2@gmail.com \ && git clone -b 4.2.x https://github.com/open-webrtc-toolkit/owt-server.git ``` ## 安装依赖 注意安装依赖环境的脚本有两个,运行任意一个都可以,但是为了安装简便性,建议运行非交互式安装脚本。 交互式安装,scripts/installDeps.sh,在安装每个依赖包前需要操作者手动确认yes/no,比较繁琐 非交互式安装,./scripts/installDepsUnattended.sh,自动安装所有依赖的软件包,不需要手动确认,方便快捷,推荐使用。 ``` cd owt-server-4.3 ./scripts/installDepsUnattended.sh && \ npm install -g node-gyp graceful-fs grunt-cli ``` ## 编译OWT-Server ``` ./scripts/build.js -t mcu --check ``` > [OWT-Server](https://github.com/open-webrtc-toolkit/owt-server)在GitHub README 上描述的是 -t all,但是对于不支持硬件加速的云主机或者虚拟机来说这样 build 会失败,所以如果不支持硬件加速或者不需要硬件加速的话,请使用-t mcu ## 编译 owt-client-javascript ``` git clone -b 4.3x https://github.com/open-webrtc-toolkit/owt-client-javascript.git cd owt-client-javascript/scripts/ npm install grunt ``` 解决 npm install报错问题: ``` npm i --unsafe-perm 然后重新执行`npm install`和`grunt` ``` ## 打包 owt-server ``` npm config set unsafe-perm false npm --unsafe-perm=true --user=0 i cd ~/owt-server-4.3/ ./scripts/pack.js -f -s ~/owt-client-javascript-4.3/dist/samples/conference/ ``` >说明: pack 成功后,会生成dist目录,dist目录里就是我们运行需要的所有文件。如果你修改了源码,需要重新执行pack。 ## 配置 owt-server 如果你的机器有多块网卡,或者对外提供服务的IP不是你本地网卡的IP,而是公网IP,你需要做如下配置。 **配置公网IP或域名,参考[Use Internet Name](https://gitee.com/winlinvip/owt-docker#use-internet-name)。** ``` # vi dist/webrtc_agent/agent.toml [webrtc] network_interfaces = [{name="eth0",replaced_ip_address="182.28.12.12"}] # default: [] # vi dist/portal/portal.toml [portal] ip_address = "182.28.12.12" #default: "" ``` ## 运行 owt-server ``` cd ~/owt-server/dist ./bin/init-all.sh --deps ./bin/start-all.sh ``` ## 验证结果 如果以上流程都顺利,接下来你就可以访问服务器的demo体验mcu功能了。 ### 测试mcu功能 访问页面:https://ip:3004 ### 测试sfu功能 访问页面:https://ip:3004/?forward=true 打开OWT的默认演示页面,私有证书需要选择`Advanced => Proceed to 192.168.1.4 (unsafe)`: * [https://192.168.1.4:3004/](https://192.168.1.4:3004/) 由于证书问题,第一次需要在浏览器,先打开OWT信令服务(Portal)页面(后续就不用了): * [https://192.168.1.4:8080/socket.io/?EIO=3&transport=polling&t=N2UmsIn](https://192.168.1.4:8080/socket.io/?EIO=3&transport=polling&t=N2UmsIn) 访问管理后台,注意启动服务时有个sampleServiceId和sampleServiceKey,打开页面会要求输入这个信息: * [https://192.168.1.4:3300/console](https://192.168.1.4:3300/console) ## Docker安装部署 参考链接:[https://gitee.com/winlinvip/owt-docker](https://gitee.com/winlinvip/owt-docker) 下载镜像 ``` sudo docker run -it -p 3004:3004 -p 3300:3300 -p 8080:8080 -p 60000-60050:60000-60050/udp \ registry.cn-hangzhou.aliyuncs.com/ossrs/owt:config bash ``` **设置OWT的IP信息,设置为Mac的IP地址。也可以自动获取和设置IP** ``` # vi dist/webrtc_agent/agent.toml [webrtc] network_interfaces = [{name="eth0",replaced_ip_address="192.168.1.4"}] # default: [] # vi dist/portal/portal.toml [portal] ip_address = "192.168.1.4" #default: "" ``` **输入命令,初始化OWT和启动服务。** ``` (cd dist && ./bin/init-all.sh && ./bin/start-all.sh) ``` ## # 问题处理 ffmpeg这些依赖在根目录build/libdeps目录下。 webrtc源码目录在third_party目录下。 node:请从头到尾使用 v8.15版本的node ``` nvm install v8.15 nvm use v8.15 ``` ### 构建无法下载chromium.googlesource.com中的代码webrtc代码的下载使用代理 需要修改wget代理, 编辑 ~/.wgetrc 文件, 设置如下内容: ``` 1. `https_proxy = http://127.0.0.1:8123/` 2. `http_proxy = http://127.0.0.1:8123/` 3. `#ftp_proxy = http://proxy.yoyodyne.com:18023/` 5. `# If you do not want to use proxy at all, set this to off.` 6. `use_proxy = on` ``` 2. licode licode 需要用到patch文件 可能会出现removeRemoteCandidate成员变量不存在 需要打补丁,是因为脚本`installCommonDeps.sh`执行不成功导致的: ``` 291 行 git am $PATHNAME/patches/licode/*.patch ``` 手动执行: ``` git am ./source/patches/licode/*.patch ``` source/agent/webrtc/webrtcLib/ 目录下的文件是licode的文件的软链接。需要直接在linux系统上git clone下来使用。而不能从,windows上git clone 然后再上传到linux机器上。 ` ` 3.owt-server的buid完成,docker镜像制作完成。 7.77G 4. owt-server的pack的细节: 打包不简单: 需要执行指令: ``` npm --unsafe-perm=true --user=0 i ``` ### 启动错误 访问后发现页面全部白屏, 检查发现tokens方法返回400. 添加参数 room=sampleRoom 返回401权限错误 更新服务器到2核4G内存,问题消失. ### 错误Could not run pkg-config ``` apt-get install -y pkg-config apt-get install libglib2.0-dev ``` ### 错误 webrtc构建错误 ``` 1. `File "/home/sunz/webrtc/owt-server-all/owt-server-4.3/third_party/webrtc/src/tools-woogeen/tmp/depto_tools/gclient_utils.py", line 264` 2. `except OSError, e:` 3. `^` 4. `SyntaxError: invalid syntax` 5. `ninja: Entering directory `out'` 6. `ninja: fatal: chdir to 'out' - No such file or directory` 7. `find: ‘./out/obj/’: 没有那个文件或目录` 8. `Generate libwebrtc.a Fail` ```