当前位置:网站首页>Webrtc quickly set up video call and video conference
Webrtc quickly set up video call and video conference
2022-07-04 05:53:00 【qq_ thirty-seven million seven hundred and five thousand five h】
webrtc Quickly build Video call Videoconferencing
1
Android:https://github.com/ddssingsong/webrtc_android
Node The server :https://github.com/ddssingsong/webrtc_server_node
Java The server :https://github.com/ddssingsong/webrtc_server_java/tree/nodejs_copy
java The version needs to see clearly that the branch is :nodejs_copy
2 install node and npm
wget https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz
# decompression
tar -xvf node-v10.16.0-linux-x64.tar.xz -C /usr/local
# Change of name
mv node-v10.16.0-linux-x64 nodejs
# Entry directory
cd nodejs/
# Make sure nodejs Next bin Does the catalog have node and npm file , If there is, you can perform a soft connection
sudo ln -s /usr/local/nodejs/bin/npm /usr/local/bin/
sudo ln -s /usr/local/nodejs/bin/node /usr/local/bin/
node -v
npm -v
3 preparation
yum -y install openssl-devel
openssl req -x509 -newkey rsa:2048 -keyout /etc/turn_server_pkey.pem -out /etc/turn_server_cert.pem -days 99999 -nodes
Generated key, And save it again /etc/turn_server_pkey.pem;
Generated cert, And save it again /etc/turn_server_cert.pem;
The period of validity 99999 God .
If you make a mistake : openssl error while loading shared libraries: libssl.so.1.1
ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1
4 install libevent
This is a c Extension library for
Libevent It's a use. C language-written 、 Lightweight open source high performance event notification Library , There are mainly the following highlights : Event driven ( event-driven), High performance ; Lightweight , Focus on the Internet , Not as good as ACE So bloated ; The source code is quite refined 、 Easy to read ; Cross platform , Support Windows、 Linux、 *BSD and Mac Os; Support for multiple I/O Multiplexing technology , epoll、 poll、 dev/poll、 select and kqueue etc. ; Support I/O, Events such as timers and signals ; Register event priority .Libevent It has been widely used , As the underlying network library ; such as memcached、 Vomit、 Nylon、 Netchat etc.
wget --no-check-certificate https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz
tar -zxvf libevent-2.1.12-stable.tar.gz
cd libevent-2.1.12-stable/
./configure
make
make install
ls -al /usr/local/lib | grep libevent
5 install coturn(turn The server ) Penetration and forwarding server
5.1 install coturn
ubuntu install
sudo apt install coturn
centos install
wget --no-check-certificate https://github.com/coturn/coturn/archive/4.5.1.1.tar.gz
tar -zxvf 4.5.1.1.tar.gz
cd coturn-4.5.1.1
./configure
make
make install

5.2 Generate users
turnadmin -a -u chr -p 11111 -r xiaosi.com
The command above , Users will be created chr, The password for 11111 , At the same time specified realm by xiaosi.com, We will revise it according to the actual situation ( Including that xiaosi.com It's all written casually )
5.3 Modify the configuration file
cd /usr/local/etc ## Go to the configuration file directory
cp turnserver.conf.default turnserver.conf
vim turnserver.conf
It's full of notes , Insert directly at the bottom
# With the former ifconfig The network card names found are consistent
relay-device=eth0
# Intranet IP
listening-ip=10.0.8.3
# Public network IP
external-ip=119.91.104.48
# User name, password , establish IceServer Time use
user=chr:11111
# Generally speaking, it is related to turnadmin Specified when creating the user realm Agreement
realm=xiaosi.com
# Port number
listening-port=3478
# Do not open the meeting report CONFIG ERROR: Empty cli-password, and so telnet cli interface is disabled! Please set a non empty cli-password! error
cli-password=qwerty
cert=/etc/turn_server_cert.pem
pkey=/etc/turn_server_pkey.pem
5.4 Turn on 3478 Of tcp and udp port
firewall-cmd --zone=public --add-port=3478/udp --permanent
firewall-cmd --zone=public --add-port=3478/tcp --permanent
firewall-cmd --reload
Check whether the port is open
firewall-cmd --zone=public --query-port=3478/tcp
firewall-cmd --zone=public --query-port=3478/udp
5.5 Opening service
It should be noted that ,-r The parameter is followed by the last step -r Value
turnserver -a -f -r xiaosi.com
then ctrl+C sign out , Use -o Parameter background start
turnserver -a -o -f -r xiaosi.com
5.6 test turn The server
webrtc-samples The official website provides an address for testing
https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/
It's like this when you go in 
add to turn The server 
Empathy , Add two , One stun, One turn,
test 
6 install webrtc Server and browser side
git clone https://github.com/ddssingsong/webrtc_server_node.git
cd webrtc_server
public/dist/js/SkyRTC-client.js, Set penetration server
vim public/dist/js/SkyRTC-client.js
vim public/dist/js/conn.js
The last line
If there is no match for wss agent
rtc.connect(“ws:” + window.location.href.substring(window.location.protocol.length).split(‘#’)[0], window.location.hash.slice(1));
If it's with nginx wss agent
rtc.connect(“wss:” + window.location.href.substring(window.location.protocol.length).split(‘#’)[0]+“/wss”, window.location.hash.slice(1));
The one in the back “/wss” It is based on your own proxy path
7 nginx To configure
mkdir /cert
openssl genrsa -out cert.pem 1024
openssl req -new -key cert.pem -out cert.csr
openssl x509 -req -days 3650 -in cert.csr -signkey cert.pem -out cert.crt
user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
gzip on;
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
# agent https
upstream web {
server 0.0.0.0:3000;
}
# agent websocket
upstream websocket {
server 0.0.0.0:3000;
}
server {
listen 443;
server_name localhost;
ssl on;
ssl_certificate /cert/cert.crt;# Configure certificate
ssl_certificate_key /cert/cert.key;# Configure key
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 50m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 SSLv2 SSLv3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
#wss Reverse proxy
location /wss {
proxy_pass http://websocket/; # Agent to the address above
proxy_read_timeout 300s;
proxy_set_header Host $host;
proxy_set_header X-Real_IP $remote_addr;
proxy_set_header X-Forwarded-for $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'Upgrade';
}
#https Reverse proxy
location / {
proxy_pass http://web/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
边栏推荐
- How to solve the component conflicts caused by scrollbars in GridView
- Signification des lettres du module optique et abréviation des paramètres Daquan
- [Excel] 数据透视图
- BUU-Reverse-easyre
- (4) Canal multi instance use
- Principle and practice of common defects in RSA encryption application
- 十二. golang其他
- BeanFactoryPostProcessor 与 BeanPostProcessor 相关子类概述
- left_and_right_net正常版本
- Solar insect killing system based on single chip microcomputer
猜你喜欢

C语言中的函数(详解)

检漏继电器JY82-2P

Actual cases and optimization solutions of cloud native architecture

The end of the Internet is rural revitalization

Steady! Huawei micro certification Huawei cloud computing service practice is stable!

JS扁平化数形结构的数组

Overview of relevant subclasses of beanfactorypostprocessor and beanpostprocessor

SQL injection - injection based on MSSQL (SQL Server)

Leakage detection relay jy82-2p

Configure cross compilation tool chain and environment variables
随机推荐
配置交叉编译工具链和环境变量
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
19.Frambuffer应用编程
left_and_right_net可解释性设计
transformer坑了多少算力
安装 Pytorch geometric
1480. 一维数组的动态和
509. Fibonacci number, all paths of climbing stairs, minimum cost of climbing stairs
APScheduler如何设置任务不并发(即第一个任务执行完再执行下一个)?
724. Find the central subscript of the array
JS execution mechanism
BUU-Reverse-easyre
Review | categories and mechanisms of action of covid-19 neutralizing antibodies and small molecule drugs
AWT介绍
冲击继电器JC-7/11/DC110V
How to determine whether an array contains an element
Configure cross compilation tool chain and environment variables
1480. Dynamic sum of one-dimensional array
js如何将秒转换成时分秒显示
Halcon图片标定,使得后续图片处理过后变成与模板图片一样