Skip to content

Fix playAudio for Response streams#1952

Merged
HAYDEN-OAI merged 4 commits into
openai:mainfrom
fallintoplace:fix/play-audio-response-stream
Jun 25, 2026
Merged

Fix playAudio for Response streams#1952
HAYDEN-OAI merged 4 commits into
openai:mainfrom
fallintoplace:fix/play-audio-response-stream

Conversation

@fallintoplace

Copy link
Copy Markdown
Contributor

Summary

  • Convert Response Web ReadableStream bodies with Readable.fromWeb() before piping them to ffplay.
  • Add a regression test using a native Response and mocked ffplay stdin.

Why

playAudio(response) treated Response.body as a Node stream and called .pipe() directly. Native fetch responses expose a Web ReadableStream, so .pipe() is not available and playback fails at runtime.

Validation

  • ./node_modules/.bin/jest tests/helpers/audio.test.ts --runInBand
  • ./node_modules/.bin/prettier --check src/helpers/audio.ts tests/helpers/audio.test.ts
  • ./node_modules/.bin/eslint src/helpers/audio.ts tests/helpers/audio.test.ts
  • ./node_modules/typescript/bin/tsc
  • ./scripts/build

@fallintoplace fallintoplace requested a review from a team as a code owner June 23, 2026 18:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fb2dc04427

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

Comment thread src/helpers/audio.ts Outdated
@HAYDEN-OAI

Copy link
Copy Markdown
Contributor

hey @fallintoplace, thanks so much for the fix and for your patience while we worked through the stream compatibility details! we’ve got both the web and node stream paths covered now, including clean error handling. merging this now 🎉

@HAYDEN-OAI HAYDEN-OAI merged commit 71d2347 into openai:main Jun 25, 2026
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