安装Kurento

可以基于主机或docker安装Kurento,主机安装脚本如下:

#sudo aptitude remove kurento-media-server
sudo apt-get update && sudo apt-get install --no-install-recommends --yes gnupg
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 5AFA7A83
sudo echo "deb [arch=amd64] http://ubuntu.openvidu.io/6.13.0 $(lsb_release -cs) kms6" > /etc/apt/sources.list.d/kurento.list
sudo apt-get update && sudo apt-get install --yes kurento-media-server

#sudo tee "/etc/apt/sources.list.d/kurento.list" >/dev/null <<EOF
## Kurento Media Server - Release packages
#deb [arch=amd64] http://ubuntu.openvidu.io/6.13.0 $(lsb_release -cs) kms6
#EOF

配置Kurento的stun服务器

默认采用的stun服务器是谷歌的,由于墙的原因无法访问,换成jitsi的,也可以是自己安装的。

vim /etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini
stunServerAddress=meet-jit-si-turnrelay.jitsi.net
stunServerPort=443

配置前端的stun服务器

以kurento-hello-world为例,编辑/src/main/resources/static/js/index.js文件,在uiStart()函数里增加变量iceservers,这个变量也可以配置turn服务器。

  var iceservers={
    "iceServers":[
      {
        urls:"stun:meet-jit-si-turnrelay.jitsi.net:443"
      }
    ]
  };

再修改底下的options变量:

  const options = {
    localVideo: uiLocalVideo,
    remoteVideo: uiRemoteVideo,
    mediaConstraints: { audio: true, video: true },
    onicecandidate: (candidate) => sendMessage({
      id: 'ADD_ICE_CANDIDATE',
      candidate: candidate,
    }),
    configuration: iceservers //修改在这里,增加了一个configuration的key
  };

启动Kurento

sudo service kurento-media-server start
sudo service kurento-media-server stop

接下来就可以按照https://doc-kurento.readthedocs.io/en/stable/user/tutorials.html里运行例子了。

参考

  1. https://doc-kurento.readthedocs.io/en/stable/user/installation.html
  2. https://blog.csdn.net/XRRRICK/article/details/85010829
05-06 11:34