ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

WebRTC: mediasoup (SFU) hands on - Part 2

Автор: Amir Eshaq

Загружено: 2021-09-14

Просмотров: 38359

Описание: In this mediasoup tutorial you will learn the basics of integrating mediasoup SFU in your node.js application. ** Please look at the description below for code and mediasoup communication steps.

** In this tutorial I have used a docker container to run the application, but you should be able to run on the environment of your choice. So we start with creating a Dockerfile and docker-compose.yml.

CODE: https://github.com/jamalag/mediasoup

We will see how to:

getUserMedia() to get local stream (@8:30)
create a Worker (@11:30) and a Router (@12:25)
request from client (@15:00) and create RTP Capabilities from the Router (@15:15)
create a Device (client-side, @13:30) and it's load() method (@14:30)
create server WebRtcTransports (for both Producer & Consumer, @17:50)
create client WebRtc[Send (@17:20)/Recv (@30:30)]Transport
transport connect event (Producer @21:20, Consumer @32:40)
transport produce event (Producer @22:45)
how to call produce(params) (@24:35)/consume from client (@34:45)
client side params declaration (@24:50)
how to call produce (@28:30)/consume (@35:25) from server side

Order to Create Transports
1. Server Transport created from Router
2. Client Transport created from Device

Order to Produce
1. Call produce() on Client Transport
2. Call produce() on Server Transport

Order to Consume
1. Call consume() on Server Transport
2. Call consume() on Client Transport

Below is the mediasoup connection and communication process:

1 Server: Create Worker
2. Client: makes socket.io connection to Server
3. Server:
sends connection success with socket id to client
creates a Router
4. Client: sends request to server for Router RTP Capabilities
5. Server: from the Router, gets rtpCapabilities and sends to Client
6. Client: with rtpCapabilities, creates a Device

PRODUCER STEPS
Assumes getUserMedia() has been executed already and track is available
7. Client: sends request to Server to create Transport
8. Server:
creates Transport (producer) from the Router
sends back to client, transport params (id, iceParameters, iceCandidates, dtlsParameters)
9. Client:
receives Server side transport params
with the params, create Send Transport from the Device (which is the Producer Transport)
call the local Producer Transport produce(params) method
listen for the following events, which are triggered by above produce() call:
'connect'
send dtlsParameters back to the Server, no need response
inform local Producer Transport that dtlsParameters were sent to the Server via callback
'produce'
send kind, rtpParameters, appData back to the Server
expects Server side Producer ID in a callback (see ** below)
send via the callback the received Server side Producer ID
10. Server:
receives dtlsParameters from the Client (see 9. above)
calls Producer Transport connect({ dtlsParameters }) method
receives kind, rtpParameters, appData from the Client (see 9. above)
calls Producer Transport produce({ ... }) and passes in the received parameters
sends Producer ID to the Client (**)

CONSUMER STEPS
[We don't need to getUserMedia()]
[Repeats steps 2 - 6 above if different client from producer]
[Repeats steps 2 - 4 above if same client as the producer]
11. Client:sends request to Server to create Transport
12. Server:
creates Transport (consumer) from the Router
sends back to client, transport params (id, iceParameters, iceCandidates, dtlsParameters)
13. Client:
receives Server side transport params
with the params, create Recv Transport from the Device (which is the Consumer Transport)
listen for the following events, which are triggered by above consume() call:
'connect'
send dtlsParameters back to the Server, no need response
inform local Producer Transport that dtlsParameters were sent to the Server via callback
14. Server:
receives dtlsParameters from the Client (see 13. above)
calls Consumer Transport connect({ dtlsParameters }) method
15. Client:
send a request to the Server for Server side Consumer to consume
receives from the Server via a callback params (id, producerId, kind, rtpParameters) (***)
executes local Consumer Transport consume({...}) with above params
retrieves track from the local Consumer
create new MediaStream from the track and set the stream to the srcObject of remoteVideo
16. Server:
receives a request with rtpCapabilities for consumer transport to consume
executes Consumer Transport consume({ rtpCapabilities }) method
makes sure the stream is paused (a later call will be made to resume)
sends back to Client consumer params (consumer id, producerId, kind, rtpParameters) (see *** above)

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
WebRTC: mediasoup (SFU) hands on - Part 2

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

WebRTC: mediasoup (SFU) 1-1 hands on - Part 3

WebRTC: mediasoup (SFU) 1-1 hands on - Part 3

Video Conferencing With MediaSoup: How Does It Work?

Video Conferencing With MediaSoup: How Does It Work?

Janus: The Server-side WebRTC Jack of All Trades - WebRTC Rockstars Asian Tour - SingaporeJS

Janus: The Server-side WebRTC Jack of All Trades - WebRTC Rockstars Asian Tour - SingaporeJS

WebRTC: mediasoup (SFU) introduction - Part 1

WebRTC: mediasoup (SFU) introduction - Part 1

Mongo DB v1 4k+ Boot Dev

Mongo DB v1 4k+ Boot Dev

is it possible to write SAFE C?  (with BILLIONS of deployments)

is it possible to write SAFE C? (with BILLIONS of deployments)

WebRTC: mediasoup (SFU)  N - N hands on - Part 4

WebRTC: mediasoup (SFU) N - N hands on - Part 4

What is MediaSoup and How Does It Work?

What is MediaSoup and How Does It Work?

Servers for WebRTC: It is not all Peer to Peer (Kranky Geek WebRTC Brazil 2016)

Servers for WebRTC: It is not all Peer to Peer (Kranky Geek WebRTC Brazil 2016)

Получите собственное аудио и видео WebRTC, используя открытый исходный код, размещенный на собств...

Получите собственное аудио и видео WebRTC, используя открытый исходный код, размещенный на собств...

WebRTC One To Many Broadcast (SFU)

WebRTC One To Many Broadcast (SFU)

Самый быстрый способ стать инженером по искусственному интеллекту в 2026 году | Навыки, проекты и...

Самый быстрый способ стать инженером по искусственному интеллекту в 2026 году | Навыки, проекты и...

SFUs and MCUs (WebRTC Tips from WebRTC.ventures)

SFUs and MCUs (WebRTC Tips from WebRTC.ventures)

WebRTC Crash Course

WebRTC Crash Course

Why aren't you using Fastify? Or Koa? Or NestJS?

Why aren't you using Fastify? Or Koa? Or NestJS?

Group calling architectures in WebRTC: MCU, SFU & P2P

Group calling architectures in WebRTC: MCU, SFU & P2P

Почему Андрей Карпати чувствует себя

Почему Андрей Карпати чувствует себя "отстающим" (и что это значит для вашей карьеры)

Nvidia CEO Jensen Huang talks about his company's latest innovations at CES 2026

Nvidia CEO Jensen Huang talks about his company's latest innovations at CES 2026

webrtc hands-on (React hooks)

webrtc hands-on (React hooks)

Web RTC Full Course & More

Web RTC Full Course & More

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]