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:
@@ -159,8 +159,16 @@ export class LiveKitClient extends EventEmitter {
|
||||
});
|
||||
|
||||
// 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}`);
|
||||
|
||||
// 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) => {
|
||||
|
||||
+1194
-1138
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user