From 8b97904144c401ab7f269e4db61c2b9a17851871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Fri, 12 Aug 2022 09:53:44 +0200 Subject: [PATCH] Fix full-screen audio MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/room/InCallView.tsx | 15 +++-- src/video-grid/AudioContainer.tsx | 85 +++++++++++++++++++++++++++ src/video-grid/VideoTileContainer.jsx | 2 - src/video-grid/useMediaStream.ts | 11 +--- 4 files changed, 99 insertions(+), 14 deletions(-) create mode 100644 src/video-grid/AudioContainer.tsx diff --git a/src/room/InCallView.tsx b/src/room/InCallView.tsx index 0e9cba1..7037765 100644 --- a/src/room/InCallView.tsx +++ b/src/room/InCallView.tsx @@ -44,10 +44,11 @@ import { UserMenuContainer } from "../UserMenuContainer"; import { useRageshakeRequestModal } from "../settings/submit-rageshake"; import { RageshakeRequestModal } from "./RageshakeRequestModal"; import { useMediaHandler } from "../settings/useMediaHandler"; -import { useShowInspector } from "../settings/useSetting"; +import { useShowInspector, useSpatialAudio } from "../settings/useSetting"; import { useModalTriggerState } from "../Modal"; import { useAudioContext } from "../video-grid/useMediaStream"; import { useFullscreen } from "../video-grid/useFullscreen"; +import { AudioContainer } from "../video-grid/AudioContainer"; import { useAudioOutputDevice } from "../video-grid/useAudioOutputDevice"; const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {}); @@ -108,6 +109,8 @@ export function InCallView({ const [layout, setLayout] = useVideoGridLayout(screenshareFeeds.length > 0); const { toggleFullscreen, fullscreenParticipant } = useFullscreen(elementRef); + const [spatialAudio] = useSpatialAudio(); + const [audioContext, audioDestination, audioRef] = useAudioContext(); const { audioOutput } = useMediaHandler(); const [showInspector] = useShowInspector(); @@ -183,7 +186,6 @@ export function InCallView({ key={fullscreenParticipant.id} item={fullscreenParticipant} getAvatar={renderAvatar} - audioOutputDevice={audioOutput} audioContext={audioContext} audioDestination={audioDestination} disableSpeakingIndicator={true} @@ -201,7 +203,6 @@ export function InCallView({ item={item} getAvatar={renderAvatar} showName={items.length > 2 || item.focused} - audioOutputDevice={audioOutput} audioContext={audioContext} audioDestination={audioDestination} disableSpeakingIndicator={items.length < 3} @@ -217,7 +218,6 @@ export function InCallView({ items, audioContext, audioDestination, - audioOutput, layout, renderAvatar, toggleFullscreen, @@ -235,6 +235,13 @@ export function InCallView({ return (