langgenius / langgenius/dify

TTS audio fails to play in browser due to Content-Type mismatch (WAV data served as audio/mpeg)

Open
#39,434 3 comments 1 reaction 0 assignees View on GitHub
🐞 bug 1.15.0
Dominant language
TypeScript
Stars
156k
Forks
24.6k
Avg merge
22h 9m
Merged PRs (30d)
610

Description

### Self Checks

- [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542).
- [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general).
- [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- [x] Please do not modify this template :) and fill in all the required fields.

### Dify version

1.15.0

### Cloud or Self Hosted

Self Hosted (Docker)

### Steps to reproduce

1.Configure TTS in ChatFlow using Tongyi's qwen3-tts-flash model.

2.Generate a conversation and click the audio playback button.

3.Observe that no sound is played.

### ✔️ Expected Behavior

Audio plays normally in the browser.

### ❌ Actual Behavior

TTS audio fails to play in the browser. The browser console shows the following error:

**Chrome**:
```
Uncaught (in promise) NotSupportedError: Failed to load because no supported source was found.
```

**Edge**:
```
Uncaught (in promise) NotSupportedError: Failed to load because no supported source was found.
```

**Firefox**:
```
Uncaught DOMException: MediaSource.addSourceBuffer: Type not supported in MediaSource
```

Upon inspecting the API response, I found:
- The actual audio data returned is **WAV format** (starts with `RIFF....WAVE`)
- But the HTTP response `Content-Type` is set to **`audio/mpeg`**

This is exactly the same root cause identified in [#35880](https://github.com/langgenius/dify/issues/35880) by @euxx:

> "The Tongyi TTS implementation does not specify an output format and returns the downloaded audio bytes unchanged. The actual response is WAV data (RIFF....WAVE, PCM 24 kHz), while Dify responds with Content-Type: audio/mpeg."

Although [#35901](https://github.com/langgenius/dify/pull/35901) was merged to fix AudioContext issues, the **audio format mismatch** between the actual WAV data and the `audio/mpeg` Content-Type header persists in v1.15.0.

Image

Image

Contributor guide

Open the contributing guide

Research direction

Start at the Tongyi qwen3-tts-flash response path used by ChatFlow and inspect where the API response Content-Type is assigned; confirm that the returned bytes begin with RIFF/WAVE. Done means browser playback works in Chrome, Edge, and Firefox without the reported unsupported-source errors.

Written by the indexing model from the issue text.

Assessment

Domain
audio-video-rtc, backend-api-design
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.