diff --git a/.gitignore b/.gitignore index 839a464..a1a4bf3 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ backend/record/ openspec/ AGENTS.md CLAUDE.md +.running_pids diff --git a/client/src/pages/meeting-detail.html b/client/src/pages/meeting-detail.html index 1fe6157..2699fb5 100644 --- a/client/src/pages/meeting-detail.html +++ b/client/src/pages/meeting-detail.html @@ -415,14 +415,39 @@ return; } - // Try with simple constraints first, fall back to more specific ones + // Filter out Stereo Mix (立體聲混音) - it's not a real microphone + const realMicrophones = audioInputs.filter(d => + !d.label.includes('立體聲混音') && + !d.label.toLowerCase().includes('stereo mix') && + d.deviceId !== 'default' // Skip default which might be Stereo Mix + ); + + // Prefer communications device or actual microphone + let selectedMic = realMicrophones.find(d => + d.deviceId === 'communications' || + d.label.includes('麥克風') || + d.label.toLowerCase().includes('microphone') + ) || realMicrophones[0]; + + console.log('Real microphones found:', realMicrophones.length); + console.log('Selected microphone:', selectedMic); + + if (!selectedMic) { + alert('No real microphone found. Only Stereo Mix detected. Please connect a microphone.'); + return; + } + + // Try with the selected microphone try { - mediaStream = await navigator.mediaDevices.getUserMedia({ audio: true }); - } catch (simpleErr) { - console.warn('Simple audio constraints failed, trying with device ID:', simpleErr); - // Try with explicit device ID mediaStream = await navigator.mediaDevices.getUserMedia({ - audio: { deviceId: audioInputs[0].deviceId } + audio: { deviceId: { exact: selectedMic.deviceId } } + }); + console.log('Successfully connected to:', selectedMic.label); + } catch (exactErr) { + console.warn('Exact device ID failed, trying preferred:', exactErr); + // Fallback: try with preferred instead of exact + mediaStream = await navigator.mediaDevices.getUserMedia({ + audio: { deviceId: selectedMic.deviceId } }); }