Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2022-07-15 11:22:13 +02:00
parent eda8404144
commit d5375ca9ed
No known key found for this signature in database
GPG Key ID: D1D45825D60C24D2
3 changed files with 20 additions and 11 deletions

View File

@ -23,7 +23,6 @@ import { VideoTile } from "./VideoTile";
import { VideoTileSettingsModal } from "./VideoTileSettingsModal";
import { useModalTriggerState } from "../Modal";
export function VideoTileContainer({
item,
width,
@ -56,11 +55,13 @@ export function VideoTileContainer({
isLocal,
localVolume
);
const { modalState: videoTileSettingsModalState, modalProps: videoTileSettingsModalProps } =
useModalTriggerState();
const {
modalState: videoTileSettingsModalState,
modalProps: videoTileSettingsModalProps,
} = useModalTriggerState();
const onOptionsPress = () => {
videoTileSettingsModalState.open();
}
};
// Firefox doesn't respect the disablePictureInPicture attribute
// https://bugzilla.mozilla.org/show_bug.cgi?id=1611831
@ -83,7 +84,12 @@ export function VideoTileContainer({
showOptions={!item.callFeed.isLocal()}
{...rest}
/>
{videoTileSettingsModalState.isOpen && <VideoTileSettingsModal {...videoTileSettingsModalProps} feed={item.callFeed} />}
{videoTileSettingsModalState.isOpen && (
<VideoTileSettingsModal
{...videoTileSettingsModalProps}
feed={item.callFeed}
/>
)}
</>
);
}

View File

@ -46,7 +46,7 @@ export function useCallFeed(callFeed) {
}
function onLocalVolumeChanged(localVolume) {
setState((prevState) => ({ ...prevState, localVolume }))
setState((prevState) => ({ ...prevState, localVolume }));
}
function onUpdateCallFeed() {
@ -69,7 +69,10 @@ export function useCallFeed(callFeed) {
CallFeedEvent.MuteStateChanged,
onMuteStateChanged
);
callFeed.removeListener(CallFeedEvent.LocalVolumeChanged, onLocalVolumeChanged);
callFeed.removeListener(
CallFeedEvent.LocalVolumeChanged,
onLocalVolumeChanged
);
callFeed.removeListener(CallFeedEvent.NewStream, onUpdateCallFeed);
}
};

View File

@ -34,7 +34,7 @@ export const useMediaStream = (
stream: MediaStream,
audioOutputDevice: string,
mute = false,
localVolume: number,
localVolume: number
): RefObject<MediaElement> => {
const mediaRef = useRef<MediaElement>();
@ -90,7 +90,7 @@ export const useMediaStream = (
if (localVolume === null || localVolume === undefined) return;
mediaRef.current.volume = localVolume;
}, [localVolume])
}, [localVolume]);
useEffect(() => {
const mediaEl = mediaRef.current;
@ -196,7 +196,7 @@ export const useSpatialMediaStream = (
audioContext: AudioContext,
audioDestination: AudioNode,
mute = false,
localVolume: number,
localVolume: number
): [RefObject<Element>, RefObject<MediaElement>] => {
const tileRef = useRef<Element>();
const [spatialAudio] = useSpatialAudio();
@ -205,7 +205,7 @@ export const useSpatialMediaStream = (
stream,
audioOutputDevice,
spatialAudio || mute,
localVolume,
localVolume
);
const pannerNodeRef = useRef<PannerNode>();