Move MediaElement interface to the global types file
This commit is contained in:
parent
dcae5ad5f2
commit
f2dbd5ff96
2 changed files with 8 additions and 8 deletions
6
src/@types/global.d.ts
vendored
6
src/@types/global.d.ts
vendored
|
|
@ -21,4 +21,10 @@ declare global {
|
||||||
// TODO: https://gitlab.matrix.org/matrix-org/olm/-/issues/10
|
// TODO: https://gitlab.matrix.org/matrix-org/olm/-/issues/10
|
||||||
OLM_OPTIONS: Record<string, string>;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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 = (
|
export const useMediaStream = (
|
||||||
stream: MediaStream,
|
stream: MediaStream,
|
||||||
audioOutputDevice: string,
|
audioOutputDevice: string,
|
||||||
mute = false
|
mute = false
|
||||||
): RefObject<HTMLMediaElement> => {
|
): RefObject<MediaElement> => {
|
||||||
const mediaRef = useRef<MediaElement>();
|
const mediaRef = useRef<MediaElement>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -182,7 +176,7 @@ export const useSpatialMediaStream = (
|
||||||
audioContext: AudioContext,
|
audioContext: AudioContext,
|
||||||
audioDestination: AudioNode,
|
audioDestination: AudioNode,
|
||||||
mute = false
|
mute = false
|
||||||
): [RefObject<Element>, RefObject<HTMLMediaElement>] => {
|
): [RefObject<Element>, RefObject<MediaElement>] => {
|
||||||
const tileRef = useRef<Element>();
|
const tileRef = useRef<Element>();
|
||||||
const [spatialAudio] = useSpatialAudio();
|
const [spatialAudio] = useSpatialAudio();
|
||||||
// If spatial audio is enabled, we handle audio separately from the video element
|
// If spatial audio is enabled, we handle audio separately from the video element
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue