centos 7安裝mediasoup
時隔3年又一次安裝mediasoup
1、升級GCC 到4.9版本以上
2、安裝node.js
退出登錄
安裝node.js
3、使用已有簽名(阿里云第一年可以申請免費ssl簽名)
4、安裝mediasoup
aiortc?
app? ? ? ? ? // 客戶端代碼
broadcasters // 用戶推流模塊,比如用FFmpeg推流到mediasoup。
server? ? ? ?// 服務(wù)端代碼,包括信令服務(wù)+媒體服務(wù)
5、安裝mediasoup server
會下載node需要的module,其中c++部分的mediasoup代碼會下載到 mediasoup-demo/server/node_modules/mediasoup 目錄下,這個目錄其實就是 mediasoup ,這個項目worker目錄下是c++,修改后直接make就可以。
出現(xiàn)warn不用管,出現(xiàn)error
若是還無法解決,請升級node版本。
若出現(xiàn)npm ERR! A git connection error occurred
出現(xiàn)這個錯誤說明版本有問題,需要重新確認各軟件版本。
6、配置修改
接下來根據(jù)實際修改配置文件,從 config.example.js 復(fù)制一份修改就好
修改幾個地方如下:
listenIp用0.0.0.0。tls的配置路徑為ssl證書目錄。
webRtcTransportOptions 和 plainTransportOptions的listenIps.ip設(shè)置你的內(nèi)網(wǎng)ip,announcedIp為公網(wǎng)ip(不設(shè)置的話,置為null)
修改完配置文件后,后臺啟動服務(wù)
7、出現(xiàn)錯誤升級python至3.7
卸載python3.6.x
8、遇到headers.tar.gz failed, reason: connect ETIMEDOUT 104.20.23.46:443錯誤時是因為國內(nèi)訪問不了
9、編譯安裝app
10、遇到Invalid tag name ">=^16.0.0": Tags may not have any characters that encodeURIComponent encodes.這個錯誤
11、打開防火墻設(shè)置端口通過規(guī)則
12、分別去server及app目錄下運行
13、若出現(xiàn)錯誤
/mnt/html/mediasoup-demo/server/lib/interactiveClient.js:16
socket.on('connect', () => process.stdin.setRawMode(true));
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?^
TypeError: process.stdin.setRawMode is not a function
? ? at Socket.<anonymous> (/mnt/html/mediasoup-demo/server/lib/interactiveClient.js:16:43)
? ? at Socket.emit (node:events:402:35)
? ? at Socket.emit (node:domain:475:12)
? ? at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1147:10)
該錯誤是由于Node 守護進程不會以 process.stdin.setRawMode(true) 啟動
14、運行
https://xxx.xxx.xxx.xxx:3000/?roomId=c6dkrubz&info=true&forceH264=true