Skip to content

Commit 5ac9460

Browse files
lukasIO1egoman
andauthored
Ensure multibandvolume returns 0 if no track is passed (#1223)
Co-authored-by: Ryan Gaus <[email protected]>
1 parent f118da6 commit 5ac9460

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

.changeset/dull-cherries-chew.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@livekit/components-react": patch
3+
---
4+
5+
Ensure multibandvolume returns 0 if no track is passed

packages/react/src/hooks/useTrackVolume.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export function useMultibandTrackVolume(
119119

120120
React.useEffect(() => {
121121
if (!track || !track?.mediaStream) {
122+
setFrequencyBands((val) => val.slice().fill(0));
122123
return;
123124
}
124125
const { analyser, cleanup } = createAudioAnalyser(track, opts.analyserOptions);

0 commit comments

Comments
 (0)