1、借鑑官網https://janus.conf.meetecho.com/docs/README.html
2、可能會碰到
libmicrohttpd-devel 安裝失敗的情況,這個時候可以直接github下載源代碼,編譯安裝
如果缺少這個庫,janus的http與https通信方式就會不支持
3、libnice
git clone https://gitlab.freedesktop.org/libnice/libnice
cd libnice
./autogen.sh
./configure --prefix=/usr
make && sudo make install
4、libsrtp,2.0.0以上
wget https://github.com/cisco/libsrtp/archive/v2.2.0.tar.gz
tar xfv v2.2.0.tar.gz
cd libsrtp-2.2.0
./configure --prefix=/usr --enable-openssl
make shared_library && sudo make install
5、libwebsocket
git clone https://libwebsockets.org/repo/libwebsockets
cd libwebsockets
# If you want the stable version of libwebsockets, uncomment the next line
# git checkout v2.4-stable
mkdir build
cd build
# See https://github.com/meetecho/janus-gateway/issues/732 re: LWS_MAX_SMP
cmake -DLWS_MAX_SMP=1 -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_C_FLAGS="-fpic" ..
make && sudo make install
6、rabbitmq用於外部業務通信
git clone https://github.com/alanxz/rabbitmq-c
cd rabbitmq-c
git submodule init
git submodule update
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX=/usr ..
make && sudo make install
7、janus源碼
git clone https://github.com/meetecho/janus-gateway.git
cd janus-gateway
./configure --enable-websockets --enable-rest
如果提示找不到libnice,執行
export PKG_CONFIG_PATH=/path/to/libnice/lib/pkgconfig`(libnice的安裝路徑)
如果提示找不到libsrtp,一樣執行對應的方式
export PKG_CONFIG_PATH=/usr/lib/libsrtp/lib/pkgconfig
如果提示找不到動態庫,執行ldconfig
命令執行完後,會顯示,支持哪些功能,
make &&make install
make configs,把一些樣本配置文件,拷貝爲可用的配置文件
配置文件配置
janus.transport.websockets.jcfg websocket的配置文件,主要配置監聽端口(app用)
janus.transport.http.jcfg http與https的配置文件,主要配置對應的端口(瀏覽器用)
8、搭建nginx
出現的各種問題,可以參考這個鏈接(主要涉及到靜態資源訪問和nginx反向代理)
https://blog.csdn.net/cgs1999/article/details/89881733
9.然後瀏覽器通過http與https訪問服務了,注意谷歌瀏覽器必須要https訪問才能調用媒體設備
android的app通過websocket訪問服務。
10、如果是局域網,環境就可以了,,如果是公網環境,並且有nat的情況,必須搭建stun與turn服務器,來ice打洞
參考https://blog.csdn.net/cgs1999/article/details/89882164
參考資料
https://www.jianshu.com/p/00a23028006e