From c7ce6897396cbf35a3f6a5b574c6f5fd6e461f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Mon, 15 Aug 2022 15:11:51 +0200 Subject: [PATCH] Fix spatial audio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/video-grid/useMediaStream.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video-grid/useMediaStream.ts b/src/video-grid/useMediaStream.ts index 236361f..d6a7e41 100644 --- a/src/video-grid/useMediaStream.ts +++ b/src/video-grid/useMediaStream.ts @@ -34,8 +34,12 @@ declare global { export const useMediaStreamTrackCount = ( stream: MediaStream ): [number, number] => { - const [audioTrackCount, setAudioTrackCount] = useState(0); - const [videoTrackCount, setVideoTrackCount] = useState(0); + const [audioTrackCount, setAudioTrackCount] = useState( + stream.getAudioTracks().length + ); + const [videoTrackCount, setVideoTrackCount] = useState( + stream.getVideoTracks().length + ); const tracksChanged = useCallback(() => { setAudioTrackCount(stream.getAudioTracks().length);