Channel Participants

Channel Participants

A participant object represents a user that is connected to a given channel. You can get the list of participants from the VideoChannel object. You will also get a list of participants with the onParticipantsChanged event.

Example onParticipantsChanged Event Payload

{
  detail: {
    // currentParticipantId: This is the connectionId of the current user
    currentParticipantId: "871f35b5-479e-4b99-acba-71ab6fe50768",
    
    // Current Channel
    channel: AudioChannel{...},
    
    // List of participants in the channel
    participants: [Participant, Participant]      
  }
}

Rendering Participants

function handleParticipantListChange(event) {
  const participants = event.detail.participants;
  let participantList = participants.map(function (participant) {
    return '<li>' + participant.name + ' (' + participant.id+ ') '+ (participant.isPublishingStream ? ' (published)' : '') + '</li>';
  }).join('');
  
  document.getElementById('channel-participants').innerHTML = `<ul>${participantList}</ul>`;
}

Last updated

Logo

© Copyright 2024 ALO.ai, Inc. • All Rights Reserved