当前位置:网站首页>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;
}
}
}
边栏推荐
- Canoe panel learning video
- left_and_right_net正常版本
- Leetcode 184 Employees with the highest wages in the Department (July 3, 2022)
- One click filtering to select Baidu online disk files
- How to solve the component conflicts caused by scrollbars in GridView
- 每周小结(*63):关于正能量
- BUU-Real-[PHP]XXE
- Nexus 6p从8.0降级6.0+root
- tutle时钟改进版
- Zzulioj:1201: mode problem
猜你喜欢
BUU-Real-[PHP]XXE
gslb(global server load balance)技术的一点理解
一键过滤选择百度网盘文件
Weekly summary (*63): about positive energy
Letter meaning and parameter abbreviation of optical module Daquan
js如何将秒转换成时分秒显示
Arc135 C (the proof is not very clear)
What is MQ?
剑指 Offer II 038. 每日温度
SQL injection - injection based on MSSQL (SQL Server)
随机推荐
Redis realizes ranking function
Impact relay jc-7/11/dc110v
Introduction to AMBA
Actual cases and optimization solutions of cloud native architecture
19.Frambuffer应用编程
Kubernets first meeting
如何避免 JVM 内存泄漏?
Excel comparator
光模塊字母含義及參數簡稱大全
JS arguments parameter usage and explanation
C language simple student management system (including source code)
HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)
配置交叉编译工具链和环境变量
left_ and_ right_ Net normal version
Invalid revision: 3.18.1-g262b901-dirty
js arguments参数使用和详解
Take you to quickly learn how to use qsort and simulate qsort
Basic concept of bus
JS how to convert seconds into hours, minutes and seconds display
Solar insect killing system based on single chip microcomputer