diff --git a/packages/web/src/hooks/useAudioTrackPlayer.js b/packages/web/src/hooks/useAudioTrackPlayer.js index bac16404..528d6fe8 100644 --- a/packages/web/src/hooks/useAudioTrackPlayer.js +++ b/packages/web/src/hooks/useAudioTrackPlayer.js @@ -71,10 +71,13 @@ export function useAudioTrackPlayer(opts) { else { // --- STANDARD MODE (0% - 100%) --- // Clean up boost pipeline if it exists + if (boostGainRef.current) { + boostGainRef.current.disconnect(); + boostGainRef.current = null; + } if (boostSourceRef.current) { boostSourceRef.current.disconnect(); boostSourceRef.current = null; - boostGainRef.current = null; } audioEl.muted = false; audioEl.volume = Math.min(volume, 1.0); @@ -84,10 +87,13 @@ export function useAudioTrackPlayer(opts) { } } return () => { + if (boostGainRef.current) { + boostGainRef.current.disconnect(); + boostGainRef.current = null; + } if (boostSourceRef.current) { boostSourceRef.current.disconnect(); boostSourceRef.current = null; - boostGainRef.current = null; } }; }, [volume, muted, track]); diff --git a/packages/web/src/hooks/useAudioTrackPlayer.ts b/packages/web/src/hooks/useAudioTrackPlayer.ts index 6a52c94a..f807a55f 100644 --- a/packages/web/src/hooks/useAudioTrackPlayer.ts +++ b/packages/web/src/hooks/useAudioTrackPlayer.ts @@ -87,10 +87,13 @@ export function useAudioTrackPlayer( } else { // --- STANDARD MODE (0% - 100%) --- // Clean up boost pipeline if it exists + if (boostGainRef.current) { + boostGainRef.current.disconnect(); + boostGainRef.current = null; + } if (boostSourceRef.current) { boostSourceRef.current.disconnect(); boostSourceRef.current = null; - boostGainRef.current = null; } audioEl.muted = false; @@ -103,10 +106,13 @@ export function useAudioTrackPlayer( } return () => { + if (boostGainRef.current) { + boostGainRef.current.disconnect(); + boostGainRef.current = null; + } if (boostSourceRef.current) { boostSourceRef.current.disconnect(); boostSourceRef.current = null; - boostGainRef.current = null; } }; }, [volume, muted, track]); diff --git a/packages/web/src/hooks/useLiveKit.js b/packages/web/src/hooks/useLiveKit.js index 861fd815..d0166388 100644 --- a/packages/web/src/hooks/useLiveKit.js +++ b/packages/web/src/hooks/useLiveKit.js @@ -124,7 +124,9 @@ export function useLiveKit() { if (!track) return; // Strict check: Track must be subscribed AND not muted to be considered "active" - if (pub.isMuted || !pub.isSubscribed) + if (pub.isMuted) + return; + if (!isLocal && !pub.isSubscribed) return; const mt = track.mediaStreamTrack; if (!mt || mt.readyState !== 'live') @@ -278,10 +280,30 @@ export function useLiveKit() { } }); newRoom.on(RoomEvent.ParticipantDisconnected, guardedUpdate); - newRoom.on(RoomEvent.TrackSubscribed, guardedUpdate); + newRoom.on(RoomEvent.TrackSubscribed, (track, publication, participant) => { + // LiveKit auto-attaches a hidden