Merge pull request #529 from vector-im/SimonBrandner/fix/audio2
This commit is contained in:
commit
ad96da59c3
1 changed files with 6 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue