twilio / twilio-video.js

Twilio’s Programmable Video JavaScript SDK
https://www.twilio.com/docs/video/javascript
Other
571 stars 217 forks source link

ParticipantConnected Event is not triggered if 2 participants join at the same time #15

Closed VinayNadig closed 7 years ago

VinayNadig commented 8 years ago

If 2 participants are invited to a conversation at the same time, the participantConnected event is not triggered on the new participant's side.

Expected Behavior:

  1. User1 invites User2 & User3 to a conversation _at the same time._
  2. participantConnected event should be triggered twice on all 3 User's clients.

Actual Behavior:

  1. User1 invites User2 & User3 to a conversation at the same time.
  2. participantConnected event is triggered twice on User1's client(browser)
  3. participantConnected event is triggered only once on User2's side (for the join of User1)
  4. participantConnected event is triggered only once on User3's side (for the join of User1)

At this point, User2 & User3 have no way of knowing that they are in the same conversation.

The issue can be replicated on the javascript quickstart - https://github.com/twilio/video-quickstart-javascript

Steps to Replicate:

  1. Clone the Quickstart Repo into 3 different folders i.e. have 3 separate folders with quickstart.html & quickstart.js files.
  2. Navigate to https://www.twilio.com/console/video/dev-tools/testing-tools after login and create 3 separate access tokens.
  3. Set the 3 access tokens in the 3 different quickstart.js files.
  4. Start all 3 servers. (You might have to edit the start_server.sh file to edit the port numbers since all 3 will try to serve on port 8000. Or you can start your own server with python -m SimpleHTTPServer in the parent directory of the 3 folders and access the html file through localhost:8000/folder1/quickstart.html
  5. Open up all three quickstart.html files in browser in separate tabs.
  6. Invite User2 & User3 to a conversation from User1's tab _at the same time_ (You will need quick fingers for this)
  7. Expected behavior would be that after the invites have successfully completed, all 3 participants should be able to see each other. Actual behavior is that User1 sees both the users. User2 & User3 only see User1 who invited them.

This only happens when users are invited at the same time though. The following sequence of steps work perfectly fine:

  1. Invite User2 from User1
  2. Wait for User2 to join.
  3. Invite User3 from User1

In this case, All 3 users can see each other.

Is there any work around for this? Is there any way to instantiate a new participant on the client side and stream their media if the participantConnected event is not triggered?

markandrus commented 7 years ago

Hi @VinayNadig,

This was an issue with twilio-conversations.js—it should be fixed in twilio-video.js. Do you mind trying out the new version? Please re-open this issue (or file another) if the issue persists.

Thanks, Mark