4

I'm using twilio as a service for a video chat app. The room is will contain only 2 participants P1 & P2

P1

  1. Gets a generated access token from the backend( with room grants added)
  2. Gets the room name from the server
  3. Connects to room

    let connectOptions = TVIConnectOptions.init(token: payload.twilioAccessToken) { (builder) in
        builder.roomName = payload.roomName
    }
    twilioLog("Will Connect to room with name \(String(describing: payload.roomName))")
    
    
    self.room = TwilioVideo.connect(with: connectOptions, delegate:self)
    
  4. func didConnect(to room: TVIRoom) Called Successfully.

P2

  1. Gets a different generated access token from the backend( with room grants added)
  2. Gets the same room name from the server
  3. Connects to room

    let connectOptions = TVIConnectOptions.init(token: payload.twilioAccessToken) { (builder) in
        builder.roomName = payload.roomName
    }
    twilioLog("Will Connect to room with name \(String(describing: payload.roomName))")
    
    
    self.room = TwilioVideo.connect(with: connectOptions, delegate:self)
    
  4. func didConnect(to room: TVIRoom) Called Successfully.

However, func room(_ room: TVIRoom, participantDidConnect participant: TVIParticipant) Never gets called. Also, room.participants returns an empty array.

Wassim Seifeddine
  • 1,002
  • 12
  • 25

2 Answers2

0
  1. If P2 joins the room when P2 is already in the room, you should be able to access P1 in room.remoteParticipants. Generally, you will want to set delegate for each participant to receive video, audio tracks from remote participants.
  2. In this case, participantDidConnect will be called on P1 side.
Tony Nguyen
  • 491
  • 3
  • 7
0

The issue was that P1 & P2 had the same identifiers. They are treated as the same participant

Wassim Seifeddine
  • 1,002
  • 12
  • 25