当前位置:网站首页>Janus series article 3 API usage guide videoroom creating a new video room
Janus series article 3 API usage guide videoroom creating a new video room
2022-07-28 17:13:00 【wangxudongx】
Janus Series three API Use guide VideoRoom API
This is one for Janus Realize video conference SFU( Selective forwarding unit ) Plug in for , That's audio / Video router . This means that the plug-in implements a virtual conference room , Peers can join and leave at any time . This room is based on publishing / A subscription model . Each peer can publish its / Her own real-time audio / Video summary : This feed becomes an available stream in the room that other participants can subscribe to . This means that the plug-in allows several different scenarios , From simple webinars ( A speaker , Several observers ) To a completely meshed Video Conference ( Each peer sends and receives to all others ).
VideoRoom The plugin documentation
Janus API Communication protocol classification
Check the installed communication protocol
Tourist device get request https://xxx.com:8089/janus/info
The following shows what we currently use Janus Support websocket and http,
Janus It also supports some other communication protocols ( Such as :RabbitMQ、MQTT、Nanomsg and UnixSockets API), This needs to be installed and deployed by yourself Janus When it's time to specify .
"transports": {
"janus.transport.http": {
"name": "JANUS REST (HTTP/HTTPS) transport plugin",
"author": "Meetecho s.r.l.",
"description": "This transport plugin adds REST (HTTP/HTTPS) support to the Janus API via libmicrohttpd.",
"version_string": "0.0.2",
"version": 2
},
"janus.transport.websockets": {
"name": "JANUS WebSockets transport plugin",
"author": "Meetecho s.r.l.",
"description": "This transport plugin adds WebSockets support to the Janus API via libwebsockets.",
"version_string": "0.0.1",
"version": 1
}
},
because http yes Janus The default protocol is also more suitable for us to demonstrate API Use , Next I'll use http To call Janus Each of them API.
Janus API Session and transaction mechanism
Business
Janus A transaction mechanism is formulated for the call from the client to the server in order to ensure multiple transactions in a session API Isolation in the calling process 、 Uniformity 、 Atomicity and persistence .
Janus The transaction mechanism of is to pass a transaction Field .
transaction Field is used to represent a session number , This number is a unique string , It can be a pure number or a combination of upper and lower case letters and numbers .
conversation
Janus The session mechanism of is not HTTP Under the (cookie + Server side session) Conversation , because Janus It is multi protocol , What may be used is websocket、rabbitmq And so on HTTP Protocol communication , So it's impossible to use http session To represent the user session .
However Janus Yes, it is janus Add /sessionid The form of forming a new path represents user session or user session link .
Janus API Usage flow
Janus Of API It is divided into path levels :
8089/janus
This path belongs to janus API Root path , We call it janus API The root path .
We can access API To get janus Some information about the server , For example, we used above (janus/info).
We need to use some to distinguish users API When you create a session .
The operation of establishing user session is to 8089/janus Requested at this path level .
By creating a session between the client and the server API We're going to get one session id.
By request 8089/janus/session id The next path API( We call it Session path ), We can operate some operations related to user sessions ( such as : Add in ).
At this time, you are communicating with the server through your own exclusive session path .
If you use a plug-in, you need to establish a plug-in session based on the user session .
Our final session path with the plug-in will be :8089/janus/session id/plugin session id
So we use janus Of videoroom For plug-ins, it takes three steps to establish a plug-in session .

Use videoroom Plug in to create a new video room example
Establish user session
curl --location --request POST 'https://192.168.188.143:8089/janus' \
--header 'Content-Type: application/json' \
--data-raw '{ "janus": "create", "transaction": "gDkWrifU2Q73" }'
{
"janus": "success",
"transaction": "gDkWrifU2Q73",
"data": {
"id": 6421975129252707
}
}
Attach to plug-in
curl --location --request POST 'https://192.168.188.143:8089/janus/6421975129252707' \
--header 'Content-Type: application/json' \
--data-raw ' { "transaction": "gDkWrifU2Q73", "janus":"attach", "plugin":"janus.plugin.videoroom" }'
{
"janus": "success",
"session_id": 6421975129252707,
"transaction": "gDkWrifU2Q73",
"data": {
"id": 537399609431468
}
}
Create a new video room
curl --location --request POST 'https://192.168.188.143:8089/janus/6421975129252707/537399609431468' \
--header 'Content-Type: application/json' \
--data-raw '{ "janus": "message", "body": { "request":"create", "room": 12345678, "permanent":false, "description":"myroomFirst", "secret":"1234", "pin":"1234", "is_private": true }, "transaction": "m2D5tESZ3fwb" }'
{
"janus": "success",
"session_id": 6421975129252707,
"transaction": "m2D5tESZ3fwb",
"sender": 537399609431468,
"plugindata": {
"plugin": "janus.plugin.videoroom",
"data": {
"videoroom": "created",
"room": 12345678,
"permanent": false
}
}
}
Janus VideoRoom Interface document
VideoRoom The plugin documentation
Related articles
WebRTC Series articles WebRTC Basic concept understanding
WebRTC Series articles One to one video call and text chat
WebRTC Series articles File sharing
WebRTC Series articles ICE Server setup coturn
WebRTC Series articles Janus stay CentOS Next installation deployment
边栏推荐
- [deep learning]: day 9 of pytorch introduction to project practice: dropout implementation (including source code)
- 数据库故障容错之系统时钟故障
- A total of 13billion flash and 400million MCU were shipped! In depth analysis of the three product lines of Zhaoyi innovation
- 累计出货130亿颗Flash,4亿颗MCU!深度解析兆易创新的三大产品线
- Probability theory and mathematical statistics Chapter 1
- Re11: read EPM legal judgment prediction via event extraction with constraints
- kubenertes 1.16集群部署问题总结
- Record development issues
- SUSE Ceph 快速部署 – Storage6
- 综合设计一个OPPE主页--页面的售后服务
猜你喜欢

Easypoi multi sheet export by template

全链路灰度在数据库上我们是怎么做的?

Unity shader transparent effect

: No such file or directory

Ugui learning notes (II) Scrollview related

RE14: reading paper illsi interpretable low resource legal decision making

Re10: are we really making much progress? Revisiting, benchmarking, and refining heterogeneous gr

Educational codeforces round 126 (rated for Div. 2) f.teleporters (two sets and two points)

MySQL installation tutorial

Atcoder regular contest 133 d.range XOR (digital dp+ classification discussion)
随机推荐
侦察机与预警机的区别
PostgreSQL weekly news - July 20, 2022
Huawei mate 40 series exposure: large curvature hyperboloid screen, 5nm kylin 1020 processor! There will also be a version of Tianji 1000+
Exercise note 5 (square of ordered array)
Rsync service deployment and parameter details
Comprehensively design an oppe homepage -- after sales service of the page
Source code of voice live broadcast app
[deep learning]: day 1 of pytorch introduction to project practice: data operation and automatic derivation
It is said that NVIDIA has held talks with Softbank and will offer more than US $32billion to acquire arm
: No such file or directory
在AD中添加差分对及连线
Facet experience -- the development side of dragon game client
Re11: read EPM legal judgment prediction via event extraction with constraints
Codeforces round 770 (Div. 2) e. fair share
2020Q2全球平板市场出货大涨26.1%:华为排名第三,联想增幅最大!
微服务架构-服务注册中心和服务网关(6.8) (转载)
Time complexity
Rsync 服务部署与参数详解
go语言慢速入门——流程控制语句
MD5 encryption verification