From 03b52cd6e2e75e2954cfff54ac6b818e7fff10a0 Mon Sep 17 00:00:00 2001 From: alger Date: Fri, 10 Apr 2026 23:19:39 +0800 Subject: [PATCH] =?UTF-8?q?fix(audio):=20=E7=A7=BB=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E9=BA=A6=E5=85=8B=E9=A3=8E=E6=9D=83?= =?UTF-8?q?=E9=99=90=E8=AF=B7=E6=B1=82=20(#639)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 枚举音频输出设备时不再调用 getUserMedia,避免安全软件误报 --- build/entitlements.mac.plist | 2 -- package.json | 1 - src/renderer/services/audioService.ts | 7 ------- 3 files changed, 10 deletions(-) diff --git a/build/entitlements.mac.plist b/build/entitlements.mac.plist index 6957ee0..8bdb11e 100644 --- a/build/entitlements.mac.plist +++ b/build/entitlements.mac.plist @@ -16,7 +16,5 @@ com.apple.security.files.downloads.read-write - com.apple.security.device.microphone - diff --git a/package.json b/package.json index 36f9156..8caa6e7 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,6 @@ "entitlements": "build/entitlements.mac.plist", "entitlementsInherit": "build/entitlements.mac.plist", "extendInfo": { - "NSMicrophoneUsageDescription": "AlgerMusicPlayer needs access to the microphone for audio visualization.", "NSCameraUsageDescription": "Application requests access to the device's camera.", "NSDocumentsFolderUsageDescription": "Application requests access to the user's Documents folder.", "NSDownloadsFolderUsageDescription": "Application requests access to the user's Downloads folder." diff --git a/src/renderer/services/audioService.ts b/src/renderer/services/audioService.ts index 141fc59..af00dae 100644 --- a/src/renderer/services/audioService.ts +++ b/src/renderer/services/audioService.ts @@ -605,13 +605,6 @@ class AudioService { public async getAudioOutputDevices(): Promise { try { - try { - const stream = await navigator.mediaDevices.getUserMedia({ audio: true }); - stream.getTracks().forEach((track) => track.stop()); - } catch { - // Continue even if permission denied - } - const devices = await navigator.mediaDevices.enumerateDevices(); const audioOutputs = devices.filter((d) => d.kind === 'audiooutput');