From 8721d5b063484cbd66af5ad0eb4de11069784dbd Mon Sep 17 00:00:00 2001 From: Takeshi NAMAO Date: Wed, 17 Jan 2024 18:48:12 +0900 Subject: [PATCH] =?UTF-8?q?gDM=20=E3=81=AE=E9=9F=B3=E5=A3=B0=E9=85=8D?= =?UTF-8?q?=E4=BF=A1=E3=81=AE=E6=9C=89=E7=84=A1=E3=82=92=20audio=20?= =?UTF-8?q?=E3=83=88=E3=82=B0=E3=83=AB=E3=81=AE=E7=8A=B6=E6=85=8B=E3=81=A8?= =?UTF-8?q?=E9=80=A3=E5=8B=95=E3=81=95=E3=81=9B=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/actions.ts | 4 ++++ src/utils.ts | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/app/actions.ts b/src/app/actions.ts index b80963ef..8ef50ea7 100644 --- a/src/app/actions.ts +++ b/src/app/actions.ts @@ -524,7 +524,9 @@ async function createMediaStream( throw new Error('Failed to call getUserMedia. Make sure domain is secure') } const mediaConstraints = { + // getDisplayMedia では配信する画面の音声を利用するため、デバイス指定 (audioInput) は使わない audio: createGetDisplayMediaAudioConstraints({ + audio: state.audio, autoGainControl: state.autoGainControl, noiseSuppression: state.noiseSuppression, echoCancellation: state.echoCancellation, @@ -576,7 +578,9 @@ async function createMediaStream( throw new Error('Failed to call getDisplayMedia. Make sure domain is secure') } const mediaStreamConstraints = { + // getDisplayMedia (mediacaptureRegion) では配信する画面の音声を利用するため、デバイス指定 (audioInput) は使わない audio: createGetDisplayMediaAudioConstraints({ + audio: state.audio, autoGainControl: state.autoGainControl, noiseSuppression: state.noiseSuppression, echoCancellation: state.echoCancellation, diff --git a/src/utils.ts b/src/utils.ts index 18bafa44..63c44918 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -456,6 +456,7 @@ export function createFakeMediaConstraints( // getDisplayMedia の audio constraints を生成 type CreateGetDisplayMediaAudioConstraintsParameters = { + audio: SoraDevtoolsState['audio'] autoGainControl: (typeof AUTO_GAIN_CONTROLS)[number] noiseSuppression: (typeof NOISE_SUPPRESSIONS)[number] echoCancellation: (typeof ECHO_CANCELLATIONS)[number] @@ -464,7 +465,11 @@ type CreateGetDisplayMediaAudioConstraintsParameters = { export function createGetDisplayMediaAudioConstraints( parameters: CreateGetDisplayMediaAudioConstraintsParameters, ): boolean | MediaTrackConstraints { - const { autoGainControl, noiseSuppression, echoCancellation, echoCancellationType } = parameters + const { audio, autoGainControl, noiseSuppression, echoCancellation, echoCancellationType } = + parameters + if (!audio) { + return false + } if (!autoGainControl && !noiseSuppression && !echoCancellation && !echoCancellationType) { return true }