Skip to content

🎙️ fix: Prefer Compatible Formats for External STT Recording - #14864

Open
berry-13 wants to merge 2 commits into
devfrom
fix/stt-recording-format-priority
Open

🎙️ fix: Prefer Compatible Formats for External STT Recording#14864
berry-13 wants to merge 2 commits into
devfrom
fix/stt-recording-format-priority

Conversation

@berry-13

@berry-13 berry-13 commented Aug 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

External STT recording now prefers audio/ogg;codecs=opus, audio/ogg, and audio/wav before 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

  • Bug fix (non-breaking change which fixes an issue)

Testing

  • cd client && npx jest src/hooks/Input/useSpeechToTextExternal.spec.ts --runInBand --coverage=false
  • npx eslint client/src/hooks/Input/useSpeechToTextExternal.ts client/src/hooks/Input/useSpeechToTextExternal.spec.ts
  • cd client && npm run typecheck -- --pretty false
  • The original contributor verified OGG recording and transcription with Firefox, Scaleway STT, and the whisper-large-v3 model.

Test Configuration:

  • Node.js v24.16.0
  • Jest with jsdom
  • Firefox with Scaleway's OpenAI-compatible Audio Transcriptions API for the manual provider check

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes

Copilot AI lite review requested due to automatic review settings August 15, 2026 05:10
@berry-13

Copy link
Copy Markdown
Collaborator Author

@codex review

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and audio/wav ahead of WebM/MP4.
  • Extracts and exports getBestSupportedMimeType for 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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: d480382989

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

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.

3 participants