Move MediaElement interface to the global types file

This commit is contained in:
Robin Townsend 2022-06-16 10:01:52 -04:00
parent dcae5ad5f2
commit f2dbd5ff96
2 changed files with 8 additions and 8 deletions

View file

@ -21,4 +21,10 @@ declare global {
// TODO: https://gitlab.matrix.org/matrix-org/olm/-/issues/10
OLM_OPTIONS: Record<string, string>;
}
// TypeScript doesn't know about the experimental setSinkId method, so we
// declare it ourselves
interface MediaElement extends HTMLMediaElement {
setSinkId: (id: string) => void;
}
}

View file

@ -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<HTMLMediaElement> => {
): RefObject<MediaElement> => {
const mediaRef = useRef<MediaElement>();
useEffect(() => {
@ -182,7 +176,7 @@ export const useSpatialMediaStream = (
audioContext: AudioContext,
audioDestination: AudioNode,
mute = false
): [RefObject<Element>, RefObject<HTMLMediaElement>] => {
): [RefObject<Element>, RefObject<MediaElement>] => {
const tileRef = useRef<Element>();
const [spatialAudio] = useSpatialAudio();
// If spatial audio is enabled, we handle audio separately from the video element