当前位置 博文首页 > 一只海星的主页:ZLMediaKit webRTC编译与测试
NB的ZLMediaKit开始支持了webrtc,今天有点时间,好奇测试之。
拉最新的master代码 已经支持webrtc
git pull origin master
编译时候cmake加上
-DENABLE_WEBRTC=on
或者直接加到CMakeLists.txt
option(ENABLE_WEBRTC "Enable WebRTC" true)
OS版本: Ubuntu 16.04
openssl版本: OpenSSL 1.1.1l-dev
openssl verison
看一下自己系统的版本
我的是openssl-1.0.2g比较老,编译的时候会遇到问题,走了一些弯路,建议大家先升级openssl版本。
git clone https://github.com/openssl/openssl.git
wget https://github.com/openssl/openssl/archive/refs/heads/OpenSSL_1_1_1-stable.zip
./config;make -j4; sudo make install
sudo ln -s /usr/local/lib/libssl.so.1.1 /usr/lib/libssl.so.1.1
sudo ln -s /usr/local/lib/libcrypto.so.1.1 /usr/lib/libcrypto.so.1.1
git clone git@github.com:cisco/libsrtp.git
./configure --enable-openssl
make -j4;sudo make install
可以用根目录脚本
build_for_linux.sh
也可以自己cmake
mkdir build;cd build; cmake -DENABLE_WEBRTC=on ../
然后就ok了
srtp2/srtp.h: 没有那个文件或目录
这是因为缺少libsrtp2这个库
so…
sudo apt-get install libsrtp0-dev
老版本行不通,老老实实编源码
这里插一句,因为openssl版本问题导致二次编译libsrtp,所以我们先搞定openssl
未定义标识符 HMAC_CTX_init
MediaServer crash
libsrtp 没有–enable-openssl
SSLUtil.cpp:315:33: error: invalid conversion from ‘const rsa_st*’ to ‘RSA* {aka rsa_st*}’ [-fpermissive]
Ubuntu 环境
服务器IP:192.168.10.9
cd /release/linux/Debug
sudo ./MediaServer -s ./ssl.pem
设备:笔记本
局域网 Windows
浏览器:Firefox 最新版本
浏览器访问:
https://192.168.10.9/webrtc/index_push.html
推流地址:
https://192.168.10.9/index/api/webrtc?app=live&stream=test&type=push
搞定
设备:荣耀平板
浏览器:华为浏览器
浏览器访问:
https://192.168.10.9/webrtc/index_play.html
拉流地址:
https://192.168.10.9/index/api/webrtc?app=live&stream=test&type=play
mediastream-factory.js:222 Uncaught TypeError: Cannot read property 'getUserMedia' of undefined
DOMException: Requested device not found
找不到摄像头,换笔记本!!!
谷歌浏览器记得开权限:
chrome://flags/#unsafely-treat-insecure-origin-as-secure
参考:
chrome浏览器不能录音:Uncaught TypeError: Cannot read property ‘getUserMedia‘ of undefined解决方法
Uncaught TypeError: navigator.mediaDevices is undefined
https才有权限请求摄像头
[技术咨询]webrtc编译libsrtp2
openssl 版本_OpenSSL升级版本到最新(1.1.1)
chrome浏览器不能录音:Uncaught TypeError: Cannot read property ‘getUserMedia‘ of undefined解决方法
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处!
更多精彩内容,欢迎访问一只海星的主页