twilio-video.js icon indicating copy to clipboard operation
twilio-video.js copied to clipboard

[Feature Request] Enable simulcast after connecting to the room

Open KaelWD opened this issue 4 years ago • 1 comments

We have rooms that start with just two users but a third can join at any time. We don't know in advance if there will be an additional member.
Currently simulcast can only be enabled when connecting to a room. We have this for all users currently for ideal quality if a third user joins, but it does result in unnecessary overhead for only two users.

If we could change preferredVideoCodecs on the fly this would be ideal.

const room = await Video.connect(token, {
  preferredVideoCodecs: [{ codec: 'VP8', simulcast: false }],
})

if (room.participants.size > 1) {
  room.setPreferredVideoCodecs([{ codec: 'VP8', simulcast: true }]
}

room.on('participantConnected', () => {
  if (room.participants.size > 1) {
    room.setPreferredVideoCodecs([{ codec: 'VP8', simulcast: true }]
  }
})

room.on('participantDisconnected', () => {
  if (room.participants.size < 2) {
    // Disable simulcast if it's no longer required
    room.setPreferredVideoCodecs([{ codec: 'VP8', simulcast: false }]
  }
})

KaelWD avatar Feb 25 '21 08:02 KaelWD

Hi @KaelWD ,

Thanks for writing in with the request. We are working on a feature that will take care of this dynamically based on the number of participants in the Room, so that you can safely specify simulcast during connect time without worrying about the number of participants. We tentatively have this scheduled for some time in Q2. Please watch this space for updates.

manjeshbhargav avatar Mar 16 '21 01:03 manjeshbhargav