fix: local stream video visibility and audio double-playback

Show local user's own screen share in their stream tile by bypassing
the isSubscribed check for local participants and auto-watching/unwatching
local streams on publish/unpublish. Eliminate audio double-playback by
detaching LiveKit's auto-attached audio elements so GlobalAudioRenderer
is the sole playback path, making attenuation and volume controls effective.
Fix GainNode leak in useAudioTrackPlayer cleanup paths.
This commit is contained in:
Jannis Braun
2026-02-20 04:47:50 +01:00
parent 44018aa588
commit 6f777f97ce
4 changed files with 108 additions and 18 deletions
@@ -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]);