diff --git a/frontend/src/components/MusicPlayer.tsx b/frontend/src/components/MusicPlayer.tsx index df1ad32..7f04a0a 100644 --- a/frontend/src/components/MusicPlayer.tsx +++ b/frontend/src/components/MusicPlayer.tsx @@ -45,6 +45,8 @@ export default function MusicPlayer() { loop: 1, playlist: active.videoId, enablejsapi: 1, + origin: window.location.origin, + modestbranding: 1, }, events: { onReady: (e: any) => { diff --git a/frontend/src/components/Timer.tsx b/frontend/src/components/Timer.tsx index 396db79..ff68348 100644 --- a/frontend/src/components/Timer.tsx +++ b/frontend/src/components/Timer.tsx @@ -68,6 +68,9 @@ export default function Timer() { if (!running) return; intervalRef.current = setInterval(() => { setRemaining((r) => { + if (mode === 'stopwatch') { + return r + 1; // count UP for stopwatch + } if (r <= 1) { stop(); if (mode === 'pomodoro') setSessions((s) => s + 1); @@ -79,7 +82,7 @@ export default function Timer() { return stop; }, [running, mode, stop]); - const progress = presetMinutes > 0 ? 1 - remaining / (presetMinutes * 60) : 0; + const progress = mode === 'stopwatch' ? 0 : (presetMinutes > 0 ? 1 - remaining / (presetMinutes * 60) : 0); return (
@@ -112,10 +115,7 @@ export default function Timer() { {/* Timer display */}
- {mode === 'stopwatch' - ? formatTime(Math.floor((presetMinutes * 60 - remaining + presetMinutes * 60) || remaining)) - : formatTime(remaining) - } + {formatTime(remaining)}
{/* Progress bar */} diff --git a/frontend/src/hooks/useConversation.ts b/frontend/src/hooks/useConversation.ts index c161be9..afaa0dc 100644 --- a/frontend/src/hooks/useConversation.ts +++ b/frontend/src/hooks/useConversation.ts @@ -307,36 +307,4 @@ function arrayBufferToBase64(buffer: ArrayBufferLike): string { return btoa(binary); } -/** Capture PCM16 mono 24kHz audio from mic and send via callback. */ -function startPCMCapture( - stream: MediaStream, - onChunk: (pcm16: Uint8Array) => void, -): { stop: () => void } { - const ctx = new AudioContext({ sampleRate: 24000 }); - const source = ctx.createMediaStreamSource(stream); - const processor = ctx.createScriptProcessor(4096, 1, 1); - let running = true; - - processor.onaudioprocess = (e) => { - if (!running) return; - const input = e.inputBuffer.getChannelData(0); - const pcm16 = new Int16Array(input.length); - for (let i = 0; i < input.length; i++) { - const s = Math.max(-1, Math.min(1, input[i])); - pcm16[i] = s < 0 ? s * 0x8000 : s * 0x7fff; - } - onChunk(new Uint8Array(pcm16.buffer)); - }; - - source.connect(processor); - processor.connect(ctx.destination); - - return { - stop: () => { - running = false; - source.disconnect(); - processor.disconnect(); - ctx.close(); - }, - }; -} +// (Legacy PCM capture removed - MediaRecorder full-blob path is active; eliminates ScriptProcessorNode deprecation)