🎙️ fix: Prefer Compatible Formats for External STT Recording - #14864
🎙️ fix: Prefer Compatible Formats for External STT Recording#14864berry-13 wants to merge 2 commits into
Conversation
|
@codex review |
There was a problem hiding this comment.
Pull request overview
This PR updates the external Speech-to-Text (STT) recording MIME type selection logic so that browsers prefer OGG (Opus) and WAV formats before falling back to WebM or MP4, improving compatibility with OpenAI-compatible transcription providers that reject WebM/MP4 uploads.
Changes:
- Reorders the MIME type preference list to prioritize
audio/ogg;codecs=opus,audio/ogg, andaudio/wavahead of WebM/MP4. - Extracts and exports
getBestSupportedMimeTypefor reuse and direct unit testing. - Adds Jest regression coverage validating both MIME priority probing order and UA-based fallbacks when no formats are supported.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| client/src/hooks/Input/useSpeechToTextExternal.ts | Updates and exports MIME-type selection to prefer OGG/WAV first while retaining existing fallback behavior. |
| client/src/hooks/Input/useSpeechToTextExternal.spec.ts | Adds regression tests to enforce MIME priority order and browser fallback defaults. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Codex Review: Didn't find any major issues. Swish! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
External STT recording now prefers
audio/ogg;codecs=opus,audio/ogg, andaudio/wavbefore WebM or MP4 when the browser supports them. Some OpenAI-compatible transcription providers reject WebM and MP4 uploads with an invalid file format response.This branch preserves the original implementation from #11528 and adds direct regression coverage for the MIME priority and existing browser fallbacks. It supersedes #11528 because its source fork does not allow maintainer edits.
Change Type
Testing
cd client && npx jest src/hooks/Input/useSpeechToTextExternal.spec.ts --runInBand --coverage=falsenpx eslint client/src/hooks/Input/useSpeechToTextExternal.ts client/src/hooks/Input/useSpeechToTextExternal.spec.tscd client && npm run typecheck -- --pretty falsewhisper-large-v3model.Test Configuration:
Checklist