Skip to content

Audio widget never plays: the media URL is left empty on Electron (isImageOrVideo excludes audio) #266

Closed

Description

@imf92

Summary

A layout with an Audio widget (an .mp3 from the library) plays fine in the CMS preview, but on the player there is no sound at all. The audio file is downloaded, XLR creates the <audio> element and calls play(), but the element has no source: the media URL composed for audio on the Electron platform is an empty string. Images and videos in the same layout get a proper http://localhost:9696/files/<file> URL.

No error is logged.

Environment

  • Player: xibo-player 4.0.12 and 4.0.13 (.deb from the GitHub releases), XLR 1.0.36
  • OS: Debian 13 (trixie) amd64, Cinnamon, X11
    • an HP 250 G5 laptop (built-in speakers, PipeWire, default sink = internal analog speakers, unmuted)
    • a KVM VM (same result in the logs)
  • CMS: Xibo CMS 4.5.3 (self-hosted)
  • The same layout plays its audio correctly in the CMS preview.

Steps to reproduce

  1. Upload an .mp3 to the library (here sample-12s.mp3, 12 s).
  2. Create a layout with one region holding an Audio widget using that file (we also have a second region with an image playlist). Publish it.
  3. Schedule it (or set it as the default layout) on a display running the Linux player.

Expected

The mp3 is heard through the default audio output.

Actual

  • The player downloads the file (GET /xmds.php?file=9.mp3&displayId=...&type=M ... 200) and it is in the local library.
  • XLR runs the media, but its url is ''. Images in the same layout get a URL:
[RENDERER] ??? XLR.debug >> Media run - show current media: {
  el: { id: 'M-46-347-aud', tag: 'audio', ... },
  media: {
    uri: '9.mp3',
    url: '',
    type: 'audio',
    render: 'native',
    fileId: '9',
    mediaId: '46',
    ...
      url: 'http://localhost:9696/files/7.png',
  • PipeWire never shows an audio output stream from the player while the layout plays (checked with pw-dump / wpctl status).
  • None of the AudioMedia debug messages (... has started loading data, ... is now playing, autoplay started) appear, which matches an <audio> element with an empty src.

Cause (as far as we can see)

In src/Modules/Generators/Generators.ts (composeResourceUrlByPlatform), the Electron branch only builds a URL for native media when params.isImageOrVideo is true:

} else if (options.platform === ConsumerPlatform.ELECTRON) {
    if (params.render === 'html' || params.mediaType === 'ticker' || params.mediaType === 'webpage') {
        resourceUrl = options.appHost + 'layout_' + ... + '.html';
    } else if (params.render === 'native' && params.isImageOrVideo) {
        resourceUrl = options.appHost + params.uri;
    }
}

and isImageOrVideo is defined in src/Modules/Media/Media.ts as:

isImageOrVideo: this.mediaType === 'image' || this.mediaType === 'video',

So for mediaType === 'audio' the URL stays '', and prepareAudioMedia() sets media.html.src = ''.

For comparison, the ChromeOS branch in Media.ts explicitly includes audio (if (this.mediaType === 'image' || this.mediaType === 'video' || this.mediaType === 'audio') { tmpUrl = composeMediaUrl(...) }).

Presumably the Electron branch should also build options.appHost + params.uri for native audio.

Workaround

None found on the official player. The same layout plays its audio on another (community) Electron-based player, so the layout and file are fine.

Activity

  1. imf92 commented on Oct 23, 2026

    @imf92
    Author

    We worked around this locally and confirmed the cause, in case it helps.

    Fix in XLR (source)

    Give native audio a URL in the Electron branch, the same way images and videos get one:

    --- a/src/Modules/Media/Media.ts
    +++ b/src/Modules/Media/Media.ts
                 isImageOrVideo: this.mediaType === 'image' || this.mediaType === 'video',
    +            isAudio: this.mediaType === 'audio',
    --- a/src/Modules/Generators/Generators.ts
    +++ b/src/Modules/Generators/Generators.ts
    -        } else if (params.render === 'native' && params.isImageOrVideo) {
    +        } else if (params.render === 'native' && (params.isImageOrVideo || params.isAudio)) {
                 resourceUrl = options.appHost + params.uri;
             }

    (The params type would need the new isAudio field as well.) We kept isImageOrVideo unchanged so the ChromeOS branch behaves exactly as before.

    Workaround for an installed player

    The renderer is bundled unminified in /usr/lib/xibo-player/resources/app/dist/renderer/assets/index-*.js (index-DN_Z9cyF.js in 4.0.12, index-DM1L415Q.js in 4.0.13), so the same two changes can be applied there as root:

    F=$(grep -l 'params.render === "native" && params.isImageOrVideo' /usr/lib/xibo-player/resources/app/dist/renderer/assets/index-*.js)
    cp -p "$F" "$F.orig"
    sed -i -e 's/isImageOrVideo: this.mediaType === "image" || this.mediaType === "video",/&\n        isAudio: this.mediaType === "audio",/' \
           -e 's/} else if (params.render === "native" \&\& params.isImageOrVideo) {/} else if (params.render === "native" \&\& (params.isImageOrVideo || params.isAudio)) {/' "$F"

    Then restart the player. This has to be applied again after every package upgrade.

    Result

    Tested on 4.0.12 (HP laptop, Debian 13) and 4.0.13 (Debian 13 VM), with the same layout as in the report:

    • the audio media now gets url: 'http://localhost:9696/files/9.mp3' instead of '';
    • AudioMedia logs autoplay started . . .;
    • PipeWire shows an output stream from xibo-player on the default sink, and the mp3 is heard through the laptop speakers.

    One more thing we noticed while testing: if the player is started from a root shell (e.g. runuser -u <user> -- env DISPLAY=:0 ... xibo-player) without XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS, it cannot reach PulseAudio/PipeWire and audio is silent even with the fix. Started normally from the desktop session it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions