()
| 155 | // Audio level animation loop |
| 156 | useEffect(() => { |
| 157 | function updateLevels() { |
| 158 | if (clientRef.current?.audio) { |
| 159 | setInputLevel(clientRef.current.audio.inputLevel) |
| 160 | setOutputLevel(clientRef.current.audio.outputLevel) |
| 161 | } |
| 162 | animationFrameRef.current = requestAnimationFrame(updateLevels) |
| 163 | } |
| 164 | |
| 165 | if (status === 'connected') { |
| 166 | updateLevels() |