livqenoDocs

ConceptsParticipant

Participant

One person (identity) in one room, with the tracks they publish.

A participant is one person (one identity) in one room. When alice joins demo-room with her token, she becomes a participant in it. Everyone else in the room sees her as a participant too.

Participants exist in your app, while the call is running. You don't create them on your backend. A participant appears when someone joins with a token, and disappears when they leave.

Why it exists

A track by itself is just audio or video. Your UI needs to know whose it is, to show "Alice's camera" with Alice's name under it. The participant links each track to a person.

Lifecycle

Token minted on your backendidentity: alice
alice's app joins the room
others get participantJoined
alice turns on camera or mic
her tracks are added to her participant
alice leaves, or her app closes
others get participantLeft
A participant's life in a room.

You choose the identity

The identity is whatever your backend put in the token: user-42, a UUID, or an email. Livqeno doesn't care what it means. Use your own user id, so you can look up the user's name and photo in your database.

  • It only has to be unique in the room.
  • Allowed characters: letters, numbers, -, _, and .
  • Up to 128 characters.

The identity is signed into the token, so nobody can pretend to be someone else.

You and everyone else

In your app, the room gives you two lists:

room.localParticipant;      // you
room.remoteParticipants;    // everyone else
TypeWhoWhat you can do
LocalParticipantYou, on this devicePublish your camera, mic, and screen.
RemoteParticipantEveryone elseSubscribe to (receive) their tracks.

Publish means "send my media to the room". Subscribe means "receive someone else's media".

Example

In your browser app, log each new arrival, and show the camera of everyone already in the room:

room.on('participantJoined', (participant) => {
  console.log(participant.identity, participant.tracks.length);
});
 
for (const p of room.remoteParticipants) {
  const camera = p.tracks.find((t) => t.kind === 'camera');
  if (camera) container.append(camera.attach());
}

People already in the room are in remoteParticipants as soon as join finishes. People who arrive later fire participantJoined. Handle both, or you'll miss someone.

Next steps

  1. Track: what a participant publishes, and how to show it.
  2. Events: every participant and track event.
  3. Rooms & participants: building the call screen.