core icon indicating copy to clipboard operation
core copied to clipboard

Feature Request: SoundCloud Integration

Open bogi9999 opened this issue 4 months ago • 6 comments

Summary

It would be a great addition to have SoundCloud integrated as a supported Content Provider or Bridge-Provider in lox-audioserver.

Proposed Functionality

  • Search & Playback: Ability to search, browse, and play SoundCloud tracks, sets/playlists, and user likes directly within the Loxone ecosystem.
  • Content Provider Module: Integration via SoundCloud's API / OAuth or as a dedicated provider bridge.
  • Multiroom Streaming: Full support for routing SoundCloud streams to assigned audio zones and room groups.

Use Case

SoundCloud is one of the largest platforms for DJ sets, live mixes, podcasts, indie music, and remix content that is not available on mainstream services like Spotify or Apple Music. Adding SoundCloud as a Content Provider would significantly broaden the available audio sources for users.

bogi9999 avatar Jul 24 '26 07:07 bogi9999

Thanks for the sugestion. There is experimental support for Soundcloud in beta 17. Please let me know if it works for you

rudyberends avatar Jul 24 '26 17:07 rudyberends

Hi,

Thanks for adding the experimental SoundCloud support.

I tested it with Beta 17. Discovery and search are working perfectly, and I can browse tracks without any issues. However, playback doesn’t work. The dashboard indicates that the audio stream is running, but no audio is actually played.

Can you confirm whether the OAuth token alone is sufficient?

I’m asking because the Music Assistant integration uses both the OAuth token and the SoundCloud Client ID. With Music Assistant, both discovery and audio playback work correctly.

So I’m wondering if the missing Client ID could be the reason why playback isn’t working here.

Thanks!

bogi9999 avatar Jul 25 '26 09:07 bogi9999

Thanks for testing, and glad browsing/search work well!

On the Client ID: this integration does use a SoundCloud client_id — it's just obtained differently than in Music Assistant. MA asks you to enter the client_id manually (alongside the token) and uses it for everything. This integration instead scrapes the same public client_id automatically from SoundCloud's web player server-side, so you don't have to enter it. It's used for both browsing and playback, exactly like MA's. Since search and browsing work for you, the client_id is being resolved correctly — and playback uses the very same one. So a missing Client ID isn't the cause, and the OAuth token alone is the right setup on your side.

For what it's worth, I can't reproduce this on my end — playback works fine here (tracks resolve and play through the output). So it's likely something environment-specific rather than a general SoundCloud issue.

"Stream running but no audio" usually means the track resolved to a stream URL but the audio pipeline (ffmpeg) couldn't actually pull/play it. A couple of things would help me pin it down:

Server logs (spam) during playback — the lines tagged SoundCloudStream / Audio|Engine / ffmpeg right after you press play. That will show whether the stream resolved, and if ffmpeg hit an error. Does it fail on every track, or only some? One caveat worth knowing: a portion of SoundCloud tracks are DRM-protected (FairPlay) and genuinely cannot be played — not by this integration, and not by Music Assistant either (it filters them out the same way). Those should report a "DRM protected" error rather than silent no-audio, but if the tracks you tested happen to be DRM-only, that would explain missing audio. Worth trying a few different tracks. What output/zone are you playing to (AirPlay, Sonos, Chromecast, Snapcast, line-out…)? "No audio" can also be an output-side issue rather than SoundCloud. The logs are the fastest way forward — paste the block from around the moment you hit play and I'll take a look.

rudyberends avatar Jul 25 '26 10:07 rudyberends

Okay, I was able to verify it.

It turns out that some streams play while others don’t. However, the one where I initially noticed the issue definitely shouldn’t be DRM-protected. It’s a bit of a trivial example, but it’s a track that my neighbor uploaded himself. The same track plays perfectly through Music Assistant (using MA Bridge as the media player), but it doesn’t play through the SoundCloud Bridge. All of my players are Sonos devices, a mix of Gen 1 and Gen 2.

The affected player in this case was a Gen 1.

[2026-07-25T11:27:25.631Z][INFO][Content|SoundCloudStream] [protocol=progressive trackId=1223474386 zoneId=1] soundcloud stream ready [2026-07-25T11:27:25.635Z][INFO][Audio|Manager] [hasStream=false label=soundcloud sourceKind=url zoneId=1] startWithResolvedSource [2026-07-25T11:27:25.637Z][INFO][Audio|Manager] [handoff=false kind=url profiles=["mp3"] zoneId=1] starting audio engine [2026-07-25T11:27:25.640Z][DEBUG][Audio|Session] [outputBitDepth=16 outputChannels=2 outputSampleRate=44100 profile=mp3 zoneId=1] spawning ffmpeg [2026-07-25T11:27:25.680Z][INFO][Audio|Manager] [sincePlayContentMs=234 source=soundcloud stream=1-6c442bec-c6fb-41ac-a850-2bf891766717 title="Der Weg Ist Das Ziel Babba Effekt Gast Mix At Tr@sher's Birthday Bash2020 - 11 - 21" zoneId=1] playback started [2026-07-25T11:27:25.700Z][INFO][Output|Sonos] [uri=x-rincon-mp3radio://192.168.10.7:7090/streams/1/current.mp3?prime=1784978845446 zoneId=1] sending playback command [2026-07-25T11:27:25.702Z][DEBUG][Output|Sonos] [action=SetAVTransportURI service=AVTransport zoneId=1] Sonos soap request [2026-07-25T11:27:25.727Z][INFO][Output|Sonos] [action=SetAVTransportURI durationMs=25 host=192.168.10.204:1400 service=AVTransport status=200 zoneId=1] Sonos action succeeded [2026-07-25T11:27:25.980Z][DEBUG][Output|Sonos] [action=Play service=AVTransport zoneId=1] Sonos soap request [2026-07-25T11:27:26.008Z][DEBUG][Audio|Session] [label=http:192.168.10.204:mp3:Linux/UPnP/1.0 primedBytes=0 primedMs=null primeWithBuffer=true profile=mp3 subscriberCount=1 zoneId=1] audio subscriber attached [2026-07-25T11:27:26.271Z][INFO][Audio|Session] [bytes=44 profile=mp3 spawnToFirstChunkMs=628 zoneId=1] ffmpeg first chunk [2026-07-25T11:27:26.272Z][INFO][Audio|Player:1] [playContentToStartedMs=234 profile=mp3 ready=true sincePlaybackStartedMs=592 sincePlayContentMs=826 source=soundcloud zoneId=1] playback first audio ready [2026-07-25T11:27:26.274Z][DEBUG][Audio|Session] [label=http:192.168.10.204:mp3:Linux/UPnP/1.0 profile=mp3 subscriberCount=0 zoneId=1] audio subscriber detached [2026-07-25T11:27:26.286Z][INFO][Output|Sonos] [action=Play durationMs=306 host=192.168.10.204:1400 service=AVTransport status=200 zoneId=1] Sonos action succeeded [2026-07-25T11:27:26.287Z][INFO][Output|Sonos] [uri=x-rincon-mp3radio://192.168.10.7:7090/streams/1/current.mp3?prime=1784978845446 zoneId=1] Sonos playback started [2026-07-25T11:27:26.297Z][INFO][Audio|Session] [bufferedBytes=44 code=0 earlyExit=true profile=mp3 runMs=654 signal=null stderr=undefined stderrAt=undefined subscribers=0 totalBytes=44 zoneId=1] ffmpeg exited [2026-07-25T11:27:26.300Z][WARN][Audio|Manager] [exitCode=0 exitSignal=null reason=undefined source=soundcloud stderr=undefined zoneId=1] playback session terminated by engine [2026-07-25T11:27:26.310Z][DEBUG][Http|Streams] [streamId=current zoneId=1] no active session for stream request

But Gen 2 is also Affected.

[2026-07-25T11:35:16.301Z][INFO][Zones|Manager] [resolvedTarget=spotify@bridge-soundcloud-ixzp9u:track:1223474386 zoneId=12] playContent [2026-07-25T11:35:16.309Z][INFO][Audio|Manager] [hasStream=false label=soundcloud sourceKind=url zoneId=12] startWithResolvedSource [2026-07-25T11:35:16.311Z][INFO][Audio|Manager] [handoff=false kind=url profiles=["mp3"] zoneId=12] starting audio engine [2026-07-25T11:35:16.314Z][INFO][Audio|Session] [profile=mp3 zoneId=12] audio session buffer config [2026-07-25T11:35:16.317Z][DEBUG][Audio|Session] spawning ffmpeg [2026-07-25T11:35:16.371Z][INFO][Audio|Engine] [profile=mp3 source=url zoneId=12] audio session started [2026-07-25T11:35:16.373Z][INFO][Audio|Manager] [source=soundcloud title="Der Weg Ist Das Ziel Babba Effekt Gast Mix At Tr@sher's Birthday Bash2020 - 11 - 21" zoneId=12] playback started [2026-07-25T11:35:16.686Z][INFO][Audio|Session] [bytes=44 profile=mp3 spawnToFirstChunkMs=363 zoneId=12] ffmpeg first chunk [2026-07-25T11:35:16.687Z][INFO][Audio|Player:12] [profile=mp3 ready=true source=soundcloud zoneId=12] playback first audio ready [2026-07-25T11:35:16.714Z][INFO][Audio|Session] [bufferedBytes=15926 code=0 earlyExit=true profile=mp3 runMs=391 totalBytes=15926 zoneId=12] ffmpeg exited [2026-07-25T11:35:16.719Z][WARN][Audio|Manager] [source=soundcloud zoneId=12] playback session terminated by engine [2026-07-25T11:35:17.057Z][SPAM][Audio|Session] [bufferBytes=7523 bytesPerSec=32151 labels=["http:192.168.10.203:mp3:Linux/UPnP/1.0"] profile=mp3 subscribers=1 zoneId=9] pipe throughput [2026-07-25T11:35:23.953Z][INFO][Zones|Manager] [resolvedTarget=spotify@bridge-soundcloud-ixzp9u:track:1223474386 zoneId=12] playContent [2026-07-25T11:35:23.959Z][INFO][Audio|Manager] [hasStream=false label=soundcloud sourceKind=url zoneId=12] startWithResolvedSource [2026-07-25T11:35:23.960Z][INFO][Audio|Manager] [handoff=false kind=url profiles=["mp3"] zoneId=12] starting audio engine [2026-07-25T11:35:23.962Z][INFO][Audio|Session] [profile=mp3 zoneId=12] audio session buffer config [2026-07-25T11:35:23.963Z][DEBUG][Audio|Session] spawning ffmpeg [2026-07-25T11:35:24.008Z][INFO][Audio|Engine] [profile=mp3 source=url zoneId=12] audio session started [2026-07-25T11:35:24.010Z][INFO][Audio|Manager] [source=soundcloud title="Der Weg Ist Das Ziel Babba Effekt Gast Mix At Tr@sher's Birthday Bash2020 - 11 - 21" zoneId=12] playback started [2026-07-25T11:35:24.176Z][SPAM][Audio|Session] [bufferBytes=7523 bytesPerSec=31576 labels=["http:192.168.10.203:mp3:Linux/UPnP/1.0"] profile=mp3 subscribers=1 zoneId=9] pipe throughput [2026-07-25T11:35:24.227Z][INFO][Audio|Session] [bytes=44 profile=mp3 spawnToFirstChunkMs=263 zoneId=12] ffmpeg first chunk [2026-07-25T11:35:24.229Z][INFO][Audio|Player:12] [profile=mp3 ready=true source=soundcloud zoneId=12] playback first audio ready [2026-07-25T11:35:24.254Z][INFO][Audio|Session] [bufferedBytes=15926 code=0 earlyExit=true profile=mp3 runMs=290 totalBytes=15926 zoneId=12] ffmpeg exited [2026-07-25T11:35:24.256Z][WARN][Audio|Manager] [source=soundcloud zoneId=12] playback session terminated by engine [2026-07-25T11:35:26.204Z][SPAM][Audio|Session] [bufferBytes=7524 bytesPerSec=31837 labels=["http:192.168.10.203:mp3:Linux/UPnP/1.0"] profile=mp3 subscribers=1 zoneId=9] pipe throughput

One additional observation:

The exact same track plays perfectly through Music Assistant using the same SoundCloud account, so the track itself appears to be fine. Could this possibly be an issue with ffmpeg? From the logs, ffmpeg only outputs a total of 44 bytes (totalBytes=44) before exiting immediately (earlyExit=true). As a result, the stream terminates almost instantly, and the server reports “no active session for stream request.”

Maybe this helps narrow down where the problem occurs.

bogi9999 avatar Jul 25 '26 11:07 bogi9999

Found and fixed it — thanks for the logs, they were spot on. The issue wasn't SoundCloud, the token, or the Client ID: the audio proxy was dropping the Content-Range header on partial (206) responses. ffmpeg probes the stream with a byte-range request, the CDN correctly replies 206 + Content-Range, but the proxy forwarded only Content-Length — so ffmpeg treated the ~128 KB probe chunk as the entire track and stopped (your totalBytes=44/128202, exit code 0).

Short tracks happened to fit in the probe, which is why some played; long tracks (like your 3-hour set) went silent while the clock kept running. Fixed on dev, and it will be in the next beta — the proxy now forwards Content-Range. Please update and let me know!

rudyberends avatar Jul 28 '26 13:07 rudyberends

"Tested it today with Beta18 and everything works like an absolute charm—I'm thrilled!

Huge thanks for the incredibly fast turn-around, top-tier debugging, and the quick fix. Going from a feature request to a fully working integration in just one week is amazing. Fantastic work!"

bogi9999 avatar Aug 01 '26 11:08 bogi9999