How to add media stream to a producer

@indie what @snnz is saying is that the rtpCapabilities which you are passing to canConsume should be the cpablilites of device not router.

The same goes for consume(), make sure you are passing device rtpCapablilites instead of router rtpCapablilites:

This is clearly mentioned in docs

I have made my code based on other project.
Ok maybe the issue can come from there.
I will try that and come back when i did.
Btw, the connection need to be done before produce and consume is called no ?
I was thinking about maybe a Promise issue too.
But yes i passed the rtpCApabilities of the router now that you say this.
So for each Producer and Consumer i have to pass the rtpCapabilities of each device.

But the rtpCapabilities is not provided by the back end to the front end when you device.load() .

Clearly, i am looking for a project who use mediasoup.
Here is the front end: mediasoup/index.js at main · jamalag/mediasoup · GitHub
Here is the back end: mediasoup/app.js at main · jamalag/mediasoup · GitHub

On the front end line 98, he get the rtpCapabilities from the router back end.
You can see that on line 115 in the back end where ehe return the rtpCapabilities from the router.
That’s exactly what i did.
Btw i just showed my code before, that’s what i did.

Am i wrong ?
It seems to work for him.

Stop copying and pasting code and learn how to write it yourself. You’ll learn more and ask less. Also a week of investment? We’ve spent years many of us, get a fucking life… You’re disposable.

(Binary is always beautiful, your first lesson JNZ)

You made one year learning the doc ?
And it’s make one month i was stuck on it (i took time to be sure every of my microservices and my front run on their own container all on the same network preventing firewall or network issues).
If you mean about how much time i code, it make 7 years now.
But i think you don’t appreciate me, just by the fact you don’t post usefull comment.

Secondly, i didn’t copy and paste any code.
I have my own architecture with NestJS microservices communicating with each other using redis, my front end communicating with my back end using websockets.
And my front end is in Angular, like pretty much everyone, i read the doc and some code made on others projects to see and understand how it works (and what was their logic behind it).

I am not an idiot copying and pasting code.

He is getting device’s rtpCapabilities here, and sending it to server:

1 Like

@indie The demo you shared is quite good, I have personally used it for my understanding and testing in my initial days with mediasoup so give it a try and used it as a base point and go up from there.

The official demo is quite big as compared to this one so give this demo a try and you will be on the right path.

@indie the people are a little angry, i can say, because this topic ‘how to add media stream to producer’, is not supposed to go beyond few replies. But as we can see that the thread is quite big now. And many of us think that this question about adding media stream to producer shouldn’t have been asked in the first place if a person have a good basic understanding of mediasoup and as per your comments it seems like you have missed some information there which is causing the confusion for you. Kindly don’t take it personally we don’t want to hurt you.

Everyone is welcome to ask about the issue and we all try to help.

@indie this is great video tutorial, from the same person whose github demo you shared:

yes i saw his video and the first one already, that’s how i got his git repo.
I didn’t had much time to work on that this 2 previous days, i will try again during the day.

1 Like

I have checked again his code and rtpCapabilities come from the router back end.
So my code is right on that

His demo project works fine on your system right? Why not take it as a base and change it as per your need to grow from there, it will be the best option for you.

No his project doesn’t work for me when i try to install it or by using docker.
But nevermind, it seems to work, i was compared to his code too…

This means you are able to producer, consume correctly now in your code?

no, his code is working, not mine

This is great. Why not take his code as a base and change it as per your needs, what is stopping you?

his project is working but not for me.
And i did the same than him, but the i can’t use his code.
My architecture is completly different.
I am using angular in front end, producer and consumer are not in the same component.
For my back end i have a signaling server communicating with another an sfu micro service with redis.

Make his project run on your system, this will tell you the things which you are doing wrong on your side.

even his docker image doesn’t work for me, is it working for you ?

It was working for me when I started using mediasoup, setup was very smooth, I think you need to resolve the issue because of which you are using docker, this will make the setup smoother for you.