Skip to content

Fix Firefox WebUI playback by falling back when audio/mpeg MSE is unsupported#458

Open
JiminyScript wants to merge 1 commit intoremsky:masterfrom
JiminyScript:fix/firefox-audio-fallback
Open

Fix Firefox WebUI playback by falling back when audio/mpeg MSE is unsupported#458
JiminyScript wants to merge 1 commit intoremsky:masterfrom
JiminyScript:fix/firefox-audio-fallback

Conversation

@JiminyScript
Copy link
Copy Markdown

Summary

The integrated WebUI currently assumes MP3 can always be streamed through MediaSource:

  • response_format: 'mp3'
  • stream: true
  • addSourceBuffer('audio/mpeg')

This breaks in Firefox, where MediaSource.isTypeSupported('audio/mpeg') returns false and playback fails with:

  • MediaSource.addSourceBuffer: Type not supported in MediaSource
  • Cannot play media. No decoders for requested formats: audio/mpeg

What this change does

  • Detects support for MP3 MediaSource playback with MediaSource.isTypeSupported('audio/mpeg')
  • Uses streaming only when supported
  • Falls back to normal blob-backed <audio> playback otherwise
  • Adds object URL cleanup
  • Adds a few null guards to avoid follow-on errors after playback setup failure

Result

  • Chromium browsers keep streaming playback
  • Firefox works instead of failing
  • No browser sniffing required

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.

1 participant