From f2dbd5ff96eac3f0651101b0fa406a89f5b69ccd Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Thu, 16 Jun 2022 10:01:52 -0400 Subject: [PATCH] Move MediaElement interface to the global types file --- src/@types/global.d.ts | 6 ++++++ src/video-grid/useMediaStream.ts | 10 ++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/@types/global.d.ts b/src/@types/global.d.ts index 35b93a7..7b5995f 100644 --- a/src/@types/global.d.ts +++ b/src/@types/global.d.ts @@ -21,4 +21,10 @@ declare global { // TODO: https://gitlab.matrix.org/matrix-org/olm/-/issues/10 OLM_OPTIONS: Record; } + + // TypeScript doesn't know about the experimental setSinkId method, so we + // declare it ourselves + interface MediaElement extends HTMLMediaElement { + setSinkId: (id: string) => void; + } } diff --git a/src/video-grid/useMediaStream.ts b/src/video-grid/useMediaStream.ts index 3709504..5565ab2 100644 --- a/src/video-grid/useMediaStream.ts +++ b/src/video-grid/useMediaStream.ts @@ -26,17 +26,11 @@ declare global { } } -// TypeScript doesn't know about the experimental setSinkId method, so we -// declare it ourselves -interface MediaElement extends HTMLMediaElement { - setSinkId: (id: string) => void; -} - export const useMediaStream = ( stream: MediaStream, audioOutputDevice: string, mute = false -): RefObject => { +): RefObject => { const mediaRef = useRef(); useEffect(() => { @@ -182,7 +176,7 @@ export const useSpatialMediaStream = ( audioContext: AudioContext, audioDestination: AudioNode, mute = false -): [RefObject, RefObject] => { +): [RefObject, RefObject] => { const tileRef = useRef(); const [spatialAudio] = useSpatialAudio(); // If spatial audio is enabled, we handle audio separately from the video element