tested WebRTC remote
I've been experimenting with adding remote access to Ensemble in a fork (R00S/Ensemble---remote-access-testing). After testing, I wanted to share some findings that might be useful for you.
I implemented WebRTC-based remote access with the help of copilot (similar to MA's desktop companion). The approach works well for API communication (browsing library, controlling remote players), but I couldn't get audio playback working on the phone itself with this method. Sendspin's audio streaming requires a direct WebSocket connection to the MA server, which proved difficult to proxy through WebRTC data channels for real-time PCM audio. I abandoned this approach without exploring other potential solutions.
For practical remote access, Cloudflare Tunnel or similar reverse proxy solutions work well and give users full functionality including local playback.
If users request remote access capability, you might find it helpful to know that reverse proxy solutions (Cloudflare Tunnel, Nginx Proxy Manager, etc.) work well. I've documented the technical details in the fork's /docs/REMOTE_ACCESS_*.md files in my REPO if they're ever useful.
I noticed the recent improvements in the main repo - Thank you for the nice work!
This is purely informational. The fork was a learning experiment, and I wanted to share the findings in case it saves you time answering user questions about remote connectivity.
P.S. - The fork is at https://github.com/R00S/Ensemble---remote-access-testing if you're curious. The main takeaway is that reverse proxy solutions work well for remote access.
Hey, thanks for sharing this! really appreciate the detailed write-up on your experiments.
So I've been down the webrtc rabbit hole too on feature/remote-connection and hit similar walls with the flutter_webrtc package - native hangs, conflicts with AudioService, all that fun stuff. ended up building my own FFI bindings to libdatachannel instead.
That said - i think there might still be a path forward here that avoids the problem you ran into with audio streaming. from digging into the MA server code, Sendspin actually uses WebRTC DataChannels for audio, not a WebSocket that needs proxying. so the architecture would be:
Peer Connection 1 (API) └── Data Channel: "ma-api" → JSON commands
Peer Connection 2 (Sendspin audio) └── Data Channel → Sendspin protocol (JSON control + binary PCM)
The signaling would go through the existing API data channel (call sendspin/ice_servers, sendspin/connect with SDP offer, etc) and then a second peer connection handles the actual audio stream.
We're not there yet though - still fighting with the FFI layer to get the basic API reliable (had to switch from callbacks to polling for local descriptions because of corrupted string pointers, stream buffer exhaustion issues, etc). can't even load the home screen rows consistently yet. but theoretically once that's stable, adding binary support to the data channel for Sendspin shouldn't be too bad.
No idea if/when we'll actually get it working, so your advice about cloudflare tunnel / tailscale is still solid for anyone who needs remote access now. just wanted to flag that there might be light at the end of the tunnel if we can get past the current FFI gremlins.
Thanks again for documenting your findings!
I'm going to shelve this implementation for now. I think only having the public STUN servers has negativity affected the the the path I have been going down. When I have time I'll set up a test rig with ha os and ma add-on, buy a month's nabu casa and start again
Following up on my earlier comment - I set up the HAOS + MA add-on test rig and made progress with a different approach.
Instead of FFI bindings to libdatachannel, I went with a "RemoteBridge" approach: a local WebSocket server on the phone that tunnels to MA via WebRTC. This lets the existing API code work unchanged - it just connects to ws://localhost:PORT instead of the real server.
@R00S your findings were spot on - Sendspin audio streaming is the hard part. Haven't cracked that yet.
What's working:
- Connection via Remote Access ID (no Nabu Casa subscription needed - they provide free TURN servers)
- Full playback controls (play/pause/skip/volume)
- Library browsing, search, queue management
- Album art for streaming services (Spotify, Tidal, Deezer, etc.)
Known limitations:
- Local playback not working yet - can only control other MA players for now, can't stream audio to the phone itself over remote
- Album art for local/OpenSubsonic content - the WebRTC tunnel only handles WebSocket traffic, not HTTP image requests. Streaming service content works because those images are on public CDNs
- Connection can occasionally drop (WebRTC stability on mobile networks)
- No auto-reconnect yet
Test build: https://github.com/CollotsSpot/Ensemble/actions/runs/21253531697/artifacts/5221259983
If anyone wants to test: go to login screen, switch to "Remote Access ID" mode, enter your ID from MA Settings → Remote Access, plus your MA credentials.
This is experimental - works best if you use Spotify/Tidal/Deezer and want to control other players remotely. If you need local playback or only have local library content, a VPN or reverse proxy setup is still the better option for now.
Feedback welcome!
We appear to have local playback working 😁
https://github.com/CollotsSpot/Ensemble/actions/runs/21259507718/artifacts/5223629253
Note: clear storage before login
I ran into a dead end again with this. can't keep a stable connection. Shelving for now. Documentation here: https://github.com/CollotsSpot/Ensemble/tree/master/docs/remote-connection