Skip to content

feat(playground): adding microphone back#1635

Merged
neelneelneel merged 1 commit intodevfrom
1283-playground-ui-refactor-2
Jul 31, 2025
Merged

feat(playground): adding microphone back#1635
neelneelneel merged 1 commit intodevfrom
1283-playground-ui-refactor-2

Conversation

@neelneelneel
Copy link
Copy Markdown
Contributor

Description

Changes Made

How to Test

  1. Steps to reproduce/test the behavior
  2. Expected outcomes

Notes

@neelneelneel neelneelneel requested a review from a team as a code owner July 31, 2025 21:12
@neelneelneel neelneelneel merged commit c24df98 into dev Jul 31, 2025
4 checks passed
@neelneelneel neelneelneel deleted the 1283-playground-ui-refactor-2 branch July 31, 2025 21:12
@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /describe

@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /update_changelog

@QodoAI-Agent
Copy link
Copy Markdown

Changelog updates: 🔄

2025-07-31

Added

  • Microphone (speech-to-text) recording support in the playground input.

to commit the new content to the CHANGELOG.md file, please type:
'/update_changelog --pr_update_changelog.push_changelog_changes=true'

@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /review

@github-actions
Copy link
Copy Markdown

@CodiumAI-Agent /improve

@QodoAI-Agent
Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Type Declarations Removed

Removed module declarations for asset files may break imports of images and SVGs across the project.

declare global {
	interface Window {
		SpeechRecognition: {
			new (): SpeechRecognition;
		};
		webkitSpeechRecognition: {
			new (): SpeechRecognition;
		};
	}

	interface SpeechRecognitionEvent extends Event {
		results: SpeechRecognitionResultList;
		resultIndex: number;
	}

	interface SpeechRecognitionErrorEvent extends Event {
		error: string;
		message: string;
	}

	interface SpeechRecognition extends EventTarget {
		continuous: boolean;
		interimResults: boolean;
		lang: string;
		start(): void;
		stop(): void;
		onstart: (() => void) | null;
		onresult: ((event: SpeechRecognitionEvent) => void) | null;
		onerror: ((event: SpeechRecognitionErrorEvent) => void) | null;
		onend: (() => void) | null;
	}
}

export {};
Speech Recognition Errors

Errors from speech recognition are only logged to console; consider notifying the user of failures to start or continue recording.

recognition.onerror = (event) => {
	console.error(event);

	// turn off and focus on element
	setIsListening(false);
	inputRef.current?.focus();
};

@neelneelneel neelneelneel restored the 1283-playground-ui-refactor-2 branch July 31, 2025 21:14
@QodoAI-Agent
Copy link
Copy Markdown

PR Code Suggestions ✨

CategorySuggestion                                                                                                                                    Impact
Possible issue
Handle errors when starting recognition

Wrap the call to recognitionRef.current.start() in a try/catch block to prevent
uncaught exceptions (e.g., permission denied) and ensure isListening is correctly
reset on failure.

packages/playground/src/components/room/RoomInput.tsx [282-286]

 const startListening = () => {
     if (recognitionRef.current && !isListening) {
-        recognitionRef.current.start();
+        try {
+            recognitionRef.current.start();
+        } catch (error) {
+            console.error("Speech recognition start failed", error);
+            setIsListening(false);
+            notification.error("Unable to start recording");
+        }
     }
 };
Suggestion importance[1-10]: 8

__

Why: Wrapping recognitionRef.current.start() in try/catch prevents uncaught exceptions (e.g., permission denied) and ensures isListening and user feedback are correctly handled.

Medium
General
Notify user on recognition error

Use the notification hook to surface an error message to the user when speech
recognition fails, especially on permission errors, instead of only logging to the
console.

packages/playground/src/components/room/RoomInput.tsx [192-198]

 recognition.onerror = (event) => {
     console.error(event);
-
-    // turn off and focus on element
+    notification.error(`Speech recognition error: ${event.error || event.message}`);
     setIsListening(false);
     inputRef.current?.focus();
 };
Suggestion importance[1-10]: 6

__

Why: Adding notification.error surfaces speech recognition failures to the user, improving UX beyond console logs.

Low
Update disabled tooltip message

Change the tooltip when speech recognition is unsupported to inform the user why the
record button is disabled.

packages/playground/src/components/room/RoomInput.tsx [386-389]

 <Tooltip
-    title={isListening ? "Stop Recording" : "Record"}
+    title={
+        !canListen
+            ? "Speech recognition not supported"
+            : isListening
+                ? "Stop Recording"
+                : "Record"
+    }
     placement="top"
 >
Suggestion importance[1-10]: 6

__

Why: Including a message for unsupported speech recognition clarifies why the record button is disabled, enhancing usability.

Low

@neelneelneel neelneelneel mentioned this pull request Jul 31, 2025
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants