MCPcopy Create free account
hub / github.com/MagicCube/agentara / handleStop

Function handleStop

web/src/components/ai-elements/speech-input.tsx:214–237  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

212 };
213
214 const handleStop = async () => {
215 for (const track of stream.getTracks()) {
216 track.stop();
217 }
218 streamRef.current = null;
219
220 const audioBlob = new Blob(audioChunksRef.current, {
221 type: "audio/webm",
222 });
223
224 if (audioBlob.size > 0 && onAudioRecordedRef.current) {
225 setIsProcessing(true);
226 try {
227 const transcript = await onAudioRecordedRef.current(audioBlob);
228 if (transcript) {
229 onTranscriptionChangeRef.current?.(transcript);
230 }
231 } catch {
232 // Error handling delegated to the onAudioRecorded caller
233 } finally {
234 setIsProcessing(false);
235 }
236 }
237 };
238
239 const handleError = () => {
240 setIsListening(false);

Callers

nothing calls this directly

Calls 1

stopMethod · 0.65

Tested by

no test coverage detected