-
Notifications
You must be signed in to change notification settings - Fork 39
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
Publisher in multiple rooms #91
base: master
Are you sure you want to change the base?
Conversation
… publishers in the room to send the blocked/unblocked event (closes mozilla#80)
See networked-aframe/naf-janus-adapter#15 if you want to play with the example I described. |
The main issue I see is that the publisher (speaker) is receiving naf updates ( So the changes here may be interesting only with an alternative transport other than "datachannel" (which uses |
While I'm thinking about it, I'm adding a note here. If you have some horizontal scaling implemented in your infra to scale the rooms on several janus instances, you need to make sure all the rooms 1,2,3,4,5 goes into the same janus instance. |
After some thinking, some changes I may do to this PR:
|
I rewrote @devfans changes against master #55 (comment)
This includes the commit from #90. I will rebase once #90 is merged.
This may not be the final implementation, maybe adding an additional message or modifying an existing message may be better.
I post it as draft if anyone want to play with it.
To play with it, in the naf-janus-adapter repo
open in 3 different tabs:
In the browser console type the following:
First user is in room 1 and room 2:
Second user in room 1:
Third user in room 2:
So all availableOccupants and mediaStreams are what we expect. Avatars and properly hearing the audio of those avatars is another thing.
If second user (room 1 tab) connected after the first user (publisher in tab 12.html), issue this command for the first user
to force sending the entities (the avatar) to participants of main room (room 1), this will create the publisher avatar (and so the networked-audio-source) in room 1 tab.
Why the publisher avatar appears in room 1 tab when it connects after the others?
Because the entities are sent with
this.syncAll(undefined, true);
on eachnetworked
component via theconnected
listener when the user connect.The other case where the entities are sent is when a datachannel open when we subscribe to a user, it calls
this.entities.completeSync(clientId, true)
that callssyncAll
on each entity, this is not the case here because the publisher subscribe to no one, this is why the publisher avatar doesn't appear if a participant goes into room 1 after the publisher.For room 2:
We never see the first user (publisher) avatar (so no audio) because the naf updates doesn't go to room 2 (because we use datachannel transport and we have
&joined.room_ids[0]
indata_recipients_for
used byincoming_data
). The first user (publisher) mediastream is there though, you can listen to it:In 12.html tab, there are some strange things happening but explainable:
Now if we use websocket transport instead of datachannel.
In the html files, add in adapter-ready listener:
instead of
incoming_data
, this will useprocess_data
that broadcasts naf updates to all rooms the publisher is in, so creating the publisher avatar in room 2 tab as well (the issue ofsyncAll
explained above still applies).But we still have the issue of ghost avatars in publisher room (12.html). This needs changes in naf-janus-adapter where we have the various
this.room
checks.The publisher doesn't hear others, that's expected for performance but you may want to at least hear the users in the main room (room 1).
So yeah here is the state of things. You will need changes in naf-janus-adapter and in your app to make use of this for a given use case.
The function incoming_data should probably do the same thing that process_data to broadcasts to all rooms I think, it doesn't make sense that it's different, well it may depend of the use case.
I don't have a clear use case myself for now. :)