chore: bump version to 1.1.1
This commit is contained in:
@@ -360,7 +360,8 @@ Thanks!`
|
||||
|
||||
<div className="flex-1 flex h-full overflow-hidden relative">
|
||||
<div className="flex-1 flex flex-col h-full overflow-hidden relative">
|
||||
{view === 'recorder' && (
|
||||
{/* Recorder - Persistent (Hidden via CSS to keep recording alive) */}
|
||||
<div className="flex-1 flex flex-col h-full overflow-hidden" style={{ display: view === 'recorder' ? 'flex' : 'none' }}>
|
||||
<Recorder
|
||||
apiKey={apiKey}
|
||||
productId={productId}
|
||||
@@ -386,8 +387,9 @@ Thanks!`
|
||||
addToast={addToast}
|
||||
selectedModel={selectedModel}
|
||||
onModelChange={handleModelChange}
|
||||
isVisible={view === 'recorder'}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{view === 'transcription' && (
|
||||
<TranscriptionView
|
||||
|
||||
@@ -42,6 +42,7 @@ interface RecorderProps {
|
||||
addToast: (msg: string, type: 'success' | 'error' | 'info', duration?: number) => void;
|
||||
selectedModel: string;
|
||||
onModelChange: (model: string) => void;
|
||||
isVisible: boolean;
|
||||
}
|
||||
|
||||
interface AudioDevice {
|
||||
@@ -246,6 +247,12 @@ const Recorder: React.FC<RecorderProps> = ({
|
||||
};
|
||||
}, [isRecording, addToast]); // Dependencies for listener setup
|
||||
|
||||
// Ref for visibility to avoid closure staleness in interval
|
||||
const isVisibleRef = useRef(props.isVisible);
|
||||
useEffect(() => {
|
||||
isVisibleRef.current = props.isVisible;
|
||||
}, [props.isVisible]);
|
||||
|
||||
// Auto-Stop Interval Effect
|
||||
useEffect(() => {
|
||||
if (!isRecording || isPaused || isWaiting) return;
|
||||
@@ -255,8 +262,9 @@ const Recorder: React.FC<RecorderProps> = ({
|
||||
const timeSinceSpeech = (now - lastSpeechTimeRef.current) / 1000;
|
||||
setSilenceDuration(timeSinceSpeech);
|
||||
|
||||
// AUTO STOP after 20 seconds of silence (ALL MODES)
|
||||
if (timeSinceSpeech > 20 && !isStoppingRef.current) {
|
||||
// AUTO STOP Logic
|
||||
// Use Ref to get LATEST visibility instantly
|
||||
if (isVisibleRef.current && timeSinceSpeech > 20 && !isStoppingRef.current) {
|
||||
console.log("Auto-stopping due to silence...");
|
||||
isStoppingRef.current = true;
|
||||
addToast('Auto-stopped due to silence', 'info');
|
||||
@@ -265,7 +273,7 @@ const Recorder: React.FC<RecorderProps> = ({
|
||||
}, 1000);
|
||||
|
||||
return () => clearInterval(interval);
|
||||
}, [isRecording, isPaused, isWaiting, recordingMode, addToast]); // Added recordingMode dependency
|
||||
}, [isRecording, isPaused, isWaiting, recordingMode, addToast]); // Removed props.isVisible dependency (using Ref)
|
||||
|
||||
// Handle Auto Start Prop
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user