Merge pull request #529 from vector-im/SimonBrandner/fix/audio2

This commit is contained in:
Šimon Brandner 2022-08-15 15:42:44 +02:00 committed by GitHub
commit ad96da59c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -34,8 +34,12 @@ declare global {
export const useMediaStreamTrackCount = ( export const useMediaStreamTrackCount = (
stream: MediaStream stream: MediaStream
): [number, number] => { ): [number, number] => {
const [audioTrackCount, setAudioTrackCount] = useState(0); const [audioTrackCount, setAudioTrackCount] = useState(
const [videoTrackCount, setVideoTrackCount] = useState(0); stream.getAudioTracks().length
);
const [videoTrackCount, setVideoTrackCount] = useState(
stream.getVideoTracks().length
);
const tracksChanged = useCallback(() => { const tracksChanged = useCallback(() => {
setAudioTrackCount(stream.getAudioTracks().length); setAudioTrackCount(stream.getAudioTracks().length);