1

What is the difference between these two ways and also which is the better way? Or both to be used?

bind on room: (as per the quickstart app)

  room.on('trackSubscribed', function(track, publication, participant) => {
  });

bind on participants: (as per the README.md git-repo)

  room.on('participantConnected', function(participant) {
    participant.on('trackSubscribed', track => trackSubscribed(div, track));
  });
KumailR
  • 505
  • 1
  • 4
  • 20

1 Answers1

1

Twilio developer evangelist here.

Both can be used. It depends on your preference.

philnash
  • 70,667
  • 10
  • 60
  • 88
  • Both can be used at the same time? Or just anyone would work perfectly? – KumailR Jan 28 '19 at 05:23
  • 1
    If you use them both at the same time you will get the events fired on both the room and the participant. You probably only want to use one, but you can choose which works better for you. – philnash Jan 28 '19 at 11:25