• springboot+kurento+coturn+contos的视频通讯服务搭建


    springboot+kurento+coturn+contos的视频通讯服务搭建


    • 服务器CentOS Linux release 7.9.2009 (Core)

    • 本案例成功于20210628

    • image-20210628111715857

      1.默认服务器已经有Docker,安装kurento

      ##下载kurento镜像
      [root@wjsmc wjsmc]# docker pull kurento/kurento-media-server:latest
      ##将端口暴露在公网3000端口
      [root@wjsmc wjsmc]# docker run -itd --name ksm -p 3000:8888 kurento/kurento-media-server /bin/bash
      ##测试
      [root@wjsmc wjsmc]# curl 
      >     --include 
      >     --header "Connection: Upgrade" 
      >     --header "Upgrade: websocket" 
      >     --header "Host: 127.0.0.1:3000" 
      >     --header "Origin: 127.0.0.1" 
      >        http://127.0.0.1:3000/kurento
      ##成功则出现以下字段
      HTTP/1.1 500 Internal Server Error
      Server: WebSocket++/0.7.0
      
      

      2.安装coturn

      [root@wjsmc wjsmc]# yum install coturn
      [root@wjsmc etc]# yum -y install openssl-devel libevent-devel libevent
      [root@wjsmc etc]# openssl req -x509 -newkey rsa:2048 -keyout /etc/turn_server_pkey.pem -out /etc/turn_server_cert.pem -days 99999 -nodes
      ##信息随便写
      [root@wjsmc coturn]# vim /etc/coturn/turnserver.conf 
      listening-port=3478
      listening-ip=私网ip
      external-ip=公网ip
      realm=公网地址
      user=用户名:密码
      [root@wjsmc coturn]# turnserver -r 公网地址:3478 -a -o -c turnserver.conf
      [root@wjsmc coturn]# ps -ef|grep turnserver
      [root@wjsmc coturn]# kill -9 xxxx
      

      3.验证turn

      验证地址STUN or TURN URI,TURN username,TURN password分别填写

      turn:你的公网地址:3478

      turnserver.conf 设置的用户名

      turnserver.conf 设置的密码

      image-20210628104319091

      出现relay说明成功

      4.设置kurento的coturn地址

      [root@wjsmc coturn]# docker exec -it ksm bash
      root@539bb198252c:/# apt-get update
      root@539bb198252c:/# apt-get install vim
      root@539bb198252c:/# vim /etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini 
      turnURL=用户名:密码@ip:3478?transport=udp
      root@539bb198252c:/# exit
      [root@wjsmc coturn]# docker restart ksm 
      

      3.下载官方实例,这里需要maven,未安装的需要的移步安装后回来继续。

      [root@wjsmc coturn]# yum install git
      [root@wjsmc kurento]# git clone https://github.com.cnpmjs.org/Kurento/kurento-tutorial-java.git
      [root@wjsmc kurento]# cd kurento-tutorial-java/kurento-one2one-call
      [root@wjsmc kurento-one2one-call]# vim ./src/main/resources/static/js/index.js 
      ##将以下内容添加,修改进incomingCall(message),call(),两函数中
      var iceservers = {
      	"iceServers": [
      		{
      			urls: ["turn:公网ip:3478"],
      			username: "xxxxx",
      			credential: "xxxx"
      		}
      	]
      };
      var options = {
          localVideo : videoInput,
          remoteVideo : videoOutput,
          onicecandidate : onIceCandidate,
          onerror : onError,
          configuration: iceservers
      }
      ##执行项目
      [root@wjsmc kurento-one2one-call]# mvn -U clean spring-boot:run     -Dspring-boot.run.jvmArguments="-Dkms.url=ws://公网ip:3000/kurento"
      

      成功!!

      踩了不少坑,连续研究了一晚上,第二天一早爬起来,终于完成。

    image-20210628111715857

  • 相关阅读:
    通过串口工具下发指令的Python脚本
    启动app-inspector报Internal Server Error
    IOS版App的控件元素定位
    Webview页面的控件元素定位
    Android版App的控件元素定位
    将Xcode升级到10.0以上版本,Appium启动报错的问题
    IOS版DesiredCapabilities参数配置
    Android版DesiredCapabilities参数配置
    Cannot instantiate the type AppiumDriver,AppiumDriver升级引发的问题
    持续集成-jenkins 环境搭建
  • 原文地址:https://www.cnblogs.com/hmcjsc/p/14943904.html
Copyright © 2020-2023  润新知