fix: écoute TrackPublished pour détecter tracks audio publiés après connexion

Problème : participant.trackPublications vide au moment de ParticipantConnected
Solution : écouter RoomEvent.TrackPublished et s'abonner au track audio dès sa publication

Flow : Client connecte → ParticipantConnected → Client publie track → TrackPublished → Souscription

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-28 14:42:22 +02:00
parent 65357c29cc
commit c562415a3d
2 changed files with 1203 additions and 1139 deletions
+9 -1
View File
@@ -159,8 +159,16 @@ export class LiveKitClient extends EventEmitter {
}); });
// Tracks - Debug tous les événements // Tracks - Debug tous les événements
this.room.on(RoomEvent.TrackPublished, (publication, participant) => { this.room.on(RoomEvent.TrackPublished, async (publication, participant) => {
console.log(`📢 Track publié par ${participant.identity}: ${publication.kind} (${publication.sid}), muted: ${publication.muted}`); console.log(`📢 Track publié par ${participant.identity}: ${publication.kind} (${publication.sid}), muted: ${publication.muted}`);
// Si c'est un track audio, s'y abonner immédiatement
if (publication.kind === 'audio' && publication.track) {
console.log(` ⚡ Track audio détecté, souscription...`);
await this._handleAudioTrack(publication.track, publication, participant);
} else if (publication.kind === 'audio' && !publication.track) {
console.log(` ⚠️ Track audio publié mais track object non disponible encore`);
}
}); });
this.room.on(RoomEvent.TrackSubscribed, async (track, publication, participant) => { this.room.on(RoomEvent.TrackSubscribed, async (track, publication, participant) => {
File diff suppressed because one or more lines are too long