Milestone: First fully usable version with robust audio and screen sharing

This commit is contained in:
Jannis Braun
2026-02-19 23:09:03 +01:00
parent 3a441d5abd
commit 140c7c38ab
+19 -2
View File
@@ -117,11 +117,15 @@ export function useLiveKit() {
p.trackPublications.forEach((pub) => { p.trackPublications.forEach((pub) => {
const track = pub.track; const track = pub.track;
if (!track) return; if (!track) return;
// Strict check: Track must be subscribed AND not muted to be considered "active"
if (pub.isMuted || !pub.isSubscribed) return;
const mt = track.mediaStreamTrack; const mt = track.mediaStreamTrack;
if (!mt || mt.readyState !== 'live') return; if (!mt || mt.readyState !== 'live') return;
if (pub.source === Track.Source.Microphone) audioTrack = mt; if (pub.source === Track.Source.Microphone) audioTrack = mt;
else if (pub.source === Track.Source.Camera && p.isCameraEnabled) videoTrack = mt; else if (pub.source === Track.Source.Camera && p.isCameraEnabled) videoTrack = mt;
else if (pub.source === Track.Source.ScreenShare && p.isScreenShareEnabled) screenTrack = mt; else if (pub.source === Track.Source.ScreenShare) screenTrack = mt; // Removed isScreenShareEnabled check to rely on track presence
}); });
const userState = useVoiceStore.getState().voiceUserStates.get(userId); const userState = useVoiceStore.getState().voiceUserStates.get(userId);
@@ -136,7 +140,20 @@ export function useLiveKit() {
if (userState) isPartMuted = userState.isMuted; if (userState) isPartMuted = userState.isMuted;
} }
allParticipants.push({ identity: p.identity, userId, username, isSpeaking: p.isSpeaking, isMuted: isPartMuted, isDeafened: isPartDeafened, isCameraOn: p.isCameraEnabled, isScreenSharing: p.isScreenShareEnabled, isLocal, audioTrack, videoTrack, screenTrack }); allParticipants.push({
identity: p.identity,
userId,
username,
isSpeaking: p.isSpeaking,
isMuted: isPartMuted,
isDeafened: isPartDeafened,
isCameraOn: !!videoTrack, // Strictly derived from active track
isScreenSharing: !!screenTrack, // Strictly derived from active track
isLocal,
audioTrack,
videoTrack,
screenTrack
});
}; };
processParticipant(r.localParticipant, true); processParticipant(r.localParticipant, true);
r.remoteParticipants.forEach((p) => processParticipant(p, false)); r.remoteParticipants.forEach((p) => processParticipant(p, false));