calm-arm-11240
08/10/2025, 2:19 PMtall-airline-16756
08/10/2025, 2:19 PMtall-airline-16756
08/10/2025, 2:20 PMcalm-arm-11240
08/10/2025, 2:21 PMtall-airline-16756
08/10/2025, 2:22 PMTrackPublished
and TrackSubscribed
events to manage microphone subscriptions. For instance, subscribe to a participant’s microphone track as soon as it’s published.
2. Filter Active Speakers: When the ActiveSpeakersChanged
event fires, filter out participants who don’t have an active microphone subscription. You can check each participant’s microphone track subscription status to do this.
Here’s a simple example to get you started:
// Keep track of participants with subscribed microphone tracks
const subscribedMicParticipants = new Set();
// Handle track subscriptions
room.on(RoomEvent.TrackSubscribed, (track, publication, participant) => {
if (participant.isRemote && track.source === Track.Source.Microphone) {
subscribedMicParticipants.add(participant);
}
});
room.on(RoomEvent.TrackUnsubscribed, (track, publication, participant) => {
if (participant.isRemote && track.source === Track.Source.Microphone) {
subscribedMicParticipants.delete(participant);
}
});
// Filter speakers based on microphone subscription
room.on(RoomEvent.ActiveSpeakersChanged, (speakers) => {
const filteredSpeakers = speakers.filter(participant => {
if (participant.isLocal) return true;
return subscribedMicParticipants.has(participant);
});
// Use filteredSpeakers in your application
});
This way, you’ll only include participants with subscribed microphone tracks in the SpeakersChanged event. Hope this helps make your app feel more connected and responsive!
Sources: JavaScript & React Components | livekit/livekit_composite | DeepWiki | Subscribing to tracks | LiveKit Docscalm-arm-11240
08/10/2025, 2:37 PMActiveSpeakersChanged
a participant need to speak with his microphone publication or any audio change in any generic publication of Kind == Audio triggers it?tall-airline-16756
08/10/2025, 2:37 PM