当前位置:网站首页>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
边栏推荐
- 技术分享 | MySQL Shell 定制化部署 MySQL 实例
- Binary representation of negative integers and floating point numbers
- 充分利用----英文
- Ugui learning notes (V) togglegroup makes multiple choice radio boxes
- 做题笔记5(有序数组的平方)
- Technology sharing | MySQL shell customized deployment MySQL instance
- Re13: read the paper gender and racial stereotype detection in legal opinion word embeddings
- Epoll horizontal departure, which edge triggers
- valarray数值库学习
- 2022牛客多校第二场CDE
猜你喜欢

Re10:读论文 Are we really making much progress? Revisiting, benchmarking, and refining heterogeneous gr

Round 1A 2022 - Code jam 2022 c.weightlifting (interval DP)

微服务架构-服务注册中心和服务网关(6.8) (转载)

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

mysql 最大建议行数2000w,靠谱吗?

Easypoi --- excel file export
![[deep learning]: introduction to pytorch to project practice: simple code to realize linear neural network (with code)](/img/19/18d6e94a1e0fa4a75b66cf8cd99595.png)
[deep learning]: introduction to pytorch to project practice: simple code to realize linear neural network (with code)

Unity shader transparent effect

在AD中添加差分对及连线

MySQL安装教程
随机推荐
Binary representation of negative integers and floating point numbers
Unity3d shader achieves ablation effect
Hikvision responded to the impact of the 'US ban': there are options for the components currently used
Unity shader depth of field effect
技术分享 | MySQL Shell 定制化部署 MySQL 实例
Ugui learning notes (II) Scrollview related
Alibaba cloud MSE supports go language traffic protection
The 2021 ICPC ASIA Taipei Regional programming contest L. leadfoot (combinatorics /2-adic assignment function +kummer theorem)
华为Mate 40系列曝光:大曲率双曲面屏,5nm麒麟1020处理器!还将有天玑1000+的版本
It is said that NVIDIA has held talks with Softbank and will offer more than US $32billion to acquire arm
PostgreSQL weekly news - July 20, 2022
Ugui learning notes (III) summary of the use of each control
Re12:读论文 Se3 Semantic Self-segmentation for Abstractive Summarization of Long Legal Documents in Low
Detailed steps for setting up SUSE storage6 environment – win10 + VMware Workstation
Technology sharing | how to recover the erroneously deleted table and the data in the table?
3D modeling tool Archicad 26 newly released
做题笔记4(第一个错误的版本,搜索插入位置)
DGL Chapter 1 (official tutorial) personal notes
Comprehensively design an oppe homepage -- page service part
Re10:读论文 Are we really making much progress? Revisiting, benchmarking, and refining heterogeneous gr