Skip to content

FLAC playback fails on Linux (NotSupportedError / FFmpegDemuxer open context failed) #951

Description

@alixsep

Summary

On Linux, Dopamine crashes when attempting to play .flac files, showing a global error dialog and then exiting.

Initial investigation suggested missing codec support, but further testing shows that Electron does have FLAC decoding support available.
The failure appears to be caused by how FLAC files are passed to Electron’s media stack (MIME type and/or source handling), causing Chromium’s demuxer to reject the source before decoding.

Environment

  • Dopamine version: 3.0.0
  • Distribution: Fedora Linux (RPM package)
  • Also tested: AppImage (same issue)
  • Desktop: GNOME (Wayland)
  • Audio backend: PipeWire
  • CPU architecture: x86_64

Steps to reproduce

  1. Install Dopamine 3.0.0 (RPM or AppImage)
  2. Add a music folder containing .flac files
  3. Attempt to play any FLAC track

Expected behavior

FLAC files should play normally.

Actual behavior

  • Playback fails immediately
  • A global error dialog is shown
  • Dopamine closes shortly afterward

Application logs

[2025-12-13 22:37:23.507] [info]  [Queue] [setTracks] Set '15' tracks. Shuffle=false
[2025-12-13 22:37:23.510] [info]  [PlaybackService] [stopAndPlay] Stopping ''
[2025-12-13 22:37:23.522] [info]  [PlaybackService] [play] Playing '/home/user/Music/test.flac'
[2025-12-13 22:37:23.625] [error] [GlobalErrorHandler] [handleError] Handling global error.
Error: Uncaught (in promise): NotSupportedError: Failed to load because no supported source was found.
[2025-12-13 22:37:23.627] [info]  [GlobalErrorHandler] [showGlobalErrorDialog] Showing global error dialog
[2025-12-13 22:37:25.143] [info]  [GlobalErrorHandler] [showGlobalErrorDialog] Closing application

DevTools / Electron diagnostics

Codec availability

In Dopamine’s DevTools console:

document.createElement("audio").canPlayType("audio/flac")

Returns:

"probably"

This indicates that Electron/Chromium does have FLAC decoding support available.

However:

const a = document.createElement("audio");
a.canPlayType("audio/x-flac");              // ""
a.canPlayType("application/octet-stream");  // ""

Chromium only accepts audio/flac, and rejects other MIME types.

Direct file playback test

Attempting to load a FLAC file directly via a file:// URL:

const a = new Audio("file:///home/user/Music/test.flac");
a.onerror = (e) => console.log(a.error);
a.play();

Produces:

MediaError {
  code: 4,
  message: "DEMUXER_ERROR_COULD_NOT_OPEN: FFmpegDemuxer: open context failed"
}

Followed by:

DOMException: Failed to load because no supported source was found.

This suggests the demuxer refuses the source before decoding, despite FLAC support being present.

Additional information

System FLAC support is present and functional:

$ gst-inspect-1.0 flac
Plugin Details:
  Name                     flac
  Description              The FLAC Lossless compressor Codec
  Filename                 /usr/lib64/gstreamer-1.0/libgstflac.so
  Version                  1.26.9
  Source module            gst-plugins-good

This confirms the issue is not a missing system codec or Fedora packaging problem.

Analysis

Based on the above, the issue appears to be:

  • FLAC decoding is available in Electron

  • Chromium rejects the source before decoding

  • Likely causes:

    • FLAC files being passed with an incorrect MIME type (e.g. audio/x-flac or application/octet-stream)
    • Blob / stream-based loading without an explicit audio/flac MIME type
    • Source handling that Chromium’s FFmpeg demuxer cannot open

This results in a NotSupportedError and application shutdown.

Suggestions

Possible ways to resolve or mitigate:

  • Ensure FLAC sources are always provided with MIME type audio/flac
  • Review blob / stream creation for local file playback
  • Fail gracefully when a source cannot be opened (instead of closing the app)
  • Consider documenting supported formats and Linux limitations
  • Optional: provide a Flatpak build with a known-good media configuration

Notes

  • MP3 and Ogg Vorbis playback work correctly
  • Issue is reproducible 100% of the time with FLAC files
  • Same behavior across RPM and AppImage builds

Thank you for your work on Dopamine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions