初始安装 licode,仅可以从本地访问,局域网访问会报 Mixed Content 错误,需要配置证书和 public ip
# 生成私钥
openssl genrsa > key.pem
# 生成证书
openssl req -new -x509 -key key.pem > cert.pem
Common Name
需要填写本机 IP
将key.pem
/cert.pem
替换到~/licode/cert/
目录
keytool -genkeypair -alias "server" -keyalg "RSA" -validity "365" -keystore "server.keystore"
Common Name
需要填客户端的服务端 IP
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS"
keystoreFile="conf/server.keystore" keystorePass="xxxx"/>
vim licode_config.js
// Public erizoController IP for websockets (useful when behind NATs)
// Use '' to automatically get IP from the interface
config.erizoController.publicIP = '192.168.3.185'; //default value: ''
config.erizoController.networkinterface = ''; //default value: ''
// This configuration is used by the clients to reach erizoController
// Use '' to use the public IP address instead of a hostname
config.erizoController.hostname = '192.168.3.185'; //default value: ''
config.erizoController.port = 8080; //default value: 8080
// Use true if clients communicate with erizoController over SSL
config.erizoController.ssl = true; //default value: false
// This configuration is used by erizoController server to listen for connections
// Use true if erizoController listens in HTTPS.
config.erizoController.listen_ssl = true; //default value: false
config.erizoController.listen_port = 8080; //default value: 8080
// Public erizoAgent IP for ICE candidates (useful when behind NATs)
// Use '' to automatically get IP from the interface
config.erizoAgent.publicIP = '192.168.3.185'; //default value: ''
config.erizoAgent.networkinterface = ''; //default value: ''
配置证书、修改 licode_config.js 后需要重启 erizoController 和 示例程序
# 根据进程id关闭erizoController、basicExample
ps aux | grep node
kill <进程id>
# 启动erizoController
./erizo_controller/initErizo_controller.sh
# 启动示例程序
./scripts/initBasicExample.sh
证书配置有误,Common Name
需要配置为服务端 IP,且需要使用 https 访问
电脑摄像头或麦克风访问失败,可尝试点击Video Only
或Audio Only
,或者换别的电脑尝试