Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Understand Code Logic #9

Open
iOSDevGarg opened this issue Oct 24, 2021 · 12 comments
Open

Understand Code Logic #9

iOSDevGarg opened this issue Oct 24, 2021 · 12 comments

Comments

@iOSDevGarg
Copy link

Can you please help me understand the core Logic of your app?
whenever a new user joins the same room.
are you creating a new Peer connection with local track as yours own track and remote Description of new user?
is it due to multiple users?

@Meonardo
Copy link
Owner

sorry for the late reply.

whenever a new user joins the same room.
are you creating a new Peer connection with local track as yours own track and remote Description of new user?
is it due to multiple users?

Yes, but it is not necessary to add local track to the new created pc(if subscribe other publisher in the room only).

@iOSDevGarg
Copy link
Author

iOSDevGarg commented Oct 28, 2021

So you are maintaining janusconnection class inside there’s a webrtc instance.
but you create a new instance of webrtc after setting the remote description and all.
For an ex. Two users are there in a call now third ones join in same webrtc instance you are updating the remote description or in the new webrtc instance ?
If i use the same instance and update the remote description will that stop my first user video ?

@Meonardo
Copy link
Owner

Two users are there in a call now third ones join in same webrtc instance you are updating the remote description or in the new webrtc instance ?

in the new webrtc instance.

here is my main logic:
create RTCPeerConnection instances for every publisher in the room(even there are only two publishers in the room);
means one JanusConnection to one publisher.

If i use the same instance and update the remote description will that stop my first user video ?

I have not tried this, so I cant give you correct answer.

@iOSDevGarg
Copy link
Author

Would you like to give a try if you have little time. I tried following your approach but fails. I don't have any server I just have firebase integrated. if possible else I am gonna scratch my head on this for sure.

@Meonardo
Copy link
Owner

Would you like to give a try if you have little time. I tried following your approach but fails. I don't have any server I just have firebase integrated. if possible else I am gonna scratch my head on this for sure.

Can you elaborate your usecase?
If I understand you correctly, you want to add one or more remote track(s) to the same PeerConnection?

I highly suggest you to build your own janus server, it will help you to understand the way how WebRTC works,
for example: to check the janus serve log, use the admin api of janus and etc...

@iOSDevGarg
Copy link
Author

iOSDevGarg commented Oct 31, 2021

Mine issue
first one started
2 connected - it showed 1st user and self video
1st user - shows self and second user video

3 connected -
1 - shows all three self and other two video
2 - self and first video (3rd user video no)
3 - self and first user video

I haven't used that publisher subscriber
All users are on same level and responds to the new user to set offer and answer

when ever a user tries to join the room, I get a callback from firebase for new user. I create new WebRTC object and set new offer

JFYI,
What actually happening is. Let me try to explain

Peer 1 - Peer 2 connection works perfect no issues
Issue occurs when Peer 3 is joined
When Peer 3 Joins - it is able to see only one either Peer 1 or Peer 2 in short who ever responded to Peer 3 Offer and made an answer.
Peer 2 Video is not visible to the Peer 3. I tried getting the ice candidates also but now sure what to do?

@Meonardo
Copy link
Owner

Meonardo commented Nov 1, 2021

I haven't used that publisher subscriber

What do you mean?

I get a callback from firebase for new user

I did not see any transport api related to Firebase.
Any chance you are not using the janus WebRTC server?

@iOSDevGarg
Copy link
Author

I am using firebase as signaling service instead of sockets to communicate and using default STUN servers for p2p connection.
Is this server code is the entire backend code ? Any API Key is required ?

@Meonardo
Copy link
Owner

Meonardo commented Nov 1, 2021

Please pay the project website a visit specially the VideoRoom plugin.

@fukemy
Copy link

fukemy commented Nov 4, 2021

great topic, but you need to know this library work with Janus, so you need to learn how it's work with janus event first to compare with your logic code in Firebase

as i know about this lib, each peerconnection require to handle audio. and video, but only localPeerConnection work with server, if you want to avoid this, just compare the handleID of peerconnection with handleID of roomJanus data

@fukemy
Copy link

fukemy commented Nov 4, 2021

@Meonardo if my explain wrong, please tech me about the problem, thanks

@Meonardo
Copy link
Owner

Meonardo commented Nov 4, 2021

@Meonardo if my explain wrong, please tech me about the problem, thanks

You are not wrong, we can find the project site notice

Notice that this is the original VideoRoom demo, and uses a different PeerConnections per each subscription: if you want to test the new multistream support, instead, try the multistream VideoRoom demo instead. The two demos are interoperable, if you want to see how different subscription mechanisms are used on the same sources.

and the project demo(janus.js) file it shows how to create & save RTCPeerConnection.

Just for my understanding,
to understand Janus videoroom plugin simply, forget the WebRTC stack temporarily,

  • to make everyone to see you in the room, publish yourself(create a RTCPeerConnection instance and add local a/v track);
  • to watch someone in the room, subscribe it(also create a RTCPeerConnection instance).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants