当前位置:网站首页>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;
}
}
}
边栏推荐
- Use of hutool Pinyin tool
- fastjson
- Risc-v-qemu-virt in FreeRTOS_ Lock mechanism analysis of GCC
- 剑指 Offer II 038. 每日温度
- Halcon图片标定,使得后续图片处理过后变成与模板图片一样
- BUU-Crypto-[GXYCTF2019]CheckIn
- Experience weekly report no. 102 (July 4, 2022)
- Yiwen unlocks Huawei's new cloud skills - the whole process of aiot development [device access - ESP end-to-side data collection [mqtt]- real time data analysis] (step-by-step screenshot is more detai
- The difference between PX EM rem
- HMS v1.0 appointment.php editid参数 SQL注入漏洞(CVE-2022-25491)
猜你喜欢
509. Fibonacci number, all paths of climbing stairs, minimum cost of climbing stairs
BUU-Crypto-[GXYCTF2019]CheckIn
JS execution mechanism
BUU-Crypto-Cipher
Sword finger offer II 038 Daily temperature
Introduction To AMBA 简单理解
19.Frambuffer应用编程
Gridview出现滚动条,组件冲突,如何解决
Arc135 C (the proof is not very clear)
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
随机推荐
How to clone objects
Win10 clear quick access - leave no trace
Zzulioj:1201: mode problem
LC周赛300
transformer坑了多少算力
How to implement lazy loading in El select (with search function)
Input displays the currently selected picture
My NVIDIA developer journey - optimizing graphics card performance
体验碎周报第 102 期(2022.7.4)
Online shrimp music will be closed in January next year. Netizens call No
JS arguments parameter usage and explanation
[Excel] 数据透视图
[MySQL practice of massive data with high concurrency, high performance and high availability -8] - transaction isolation mechanism of InnoDB
Sword finger offer II 038 Daily temperature
Nexus 6p从8.0降级6.0+root
left_ and_ right_ Net normal version
70000 words of detailed explanation of the whole process of pad openvino [CPU] - from environment configuration to model deployment
Introduction to AMBA
接地继电器DD-1/60
How to determine whether an array contains an element