当前位置:网站首页>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;
}
}
}
边栏推荐
- 【雕爷学编程】Arduino动手做(105)---压电陶瓷振动模块
- ANSYS command
- 509. Fibonacci number, all paths of climbing stairs, minimum cost of climbing stairs
- [excel] PivotChart
- VB. Net calls ffmpeg to simply process video (class Library-6)
- Tutle clock improved version
- Excel comparator
- left_and_right_net可解释性设计
- JS execution mechanism
- 19.Frambuffer应用编程
猜你喜欢
接地继电器DD-1/60
C语言中的函数(详解)
LayoutManager布局管理器:FlowLayout、BorderLayout、GridLayout、GridBagLayout、CardLayout、BoxLayout
Take you to quickly learn how to use qsort and simulate qsort
Uninstall Google drive hard drive - you must exit the program to uninstall
Experience weekly report no. 102 (July 4, 2022)
云原生架构实战案例及优化解决方案
How to expand all collapse panels
一键过滤选择百度网盘文件
Grounding relay dd-1/60
随机推荐
Zhanrui tankbang | jointly build, cooperate and win-win zhanrui core ecology
Zzulioj:1201: mode problem
如何避免 JVM 内存泄漏?
Risc-v-qemu-virt in FreeRTOS_ Lock mechanism analysis of GCC
【微服务】Nacos集群搭建以及加载文件配置
Tf/pytorch/cafe-cv/nlp/ audio - practical demonstration of full ecosystem CPU deployment - Intel openvino tool suite course summary (Part 2)
Accidentally deleted the data file of Clickhouse, can it be restored?
Arc135 C (the proof is not very clear)
Google Chrome browser will support the function of selecting text translation
XII Golang others
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
Easy change
left_and_right_net可解释性设计
谷歌 Chrome 浏览器将支持选取文字翻译功能
What is MQ?
我的NVIDIA开发者之旅——优化显卡性能
Letter meaning and parameter abbreviation of optical module Daquan
Overview of relevant subclasses of beanfactorypostprocessor and beanpostprocessor
注释与注解
Recommended system 1 --- framework