Remote Device Control (Connect P2P & Jellyfin Sessions)
Audience: End users and technical evaluators Last Updated: 2026-04-08 Version: 2.0.0
Overview
Llamafin provides Remote Device Control — a system that lets you control music playback on other devices from your current device. Whether you're using Jellyfin's built-in session management or Llamafin's peer-to-peer Connect protocol, you can control playback anywhere in your home or office.
💡 What This Feature Does NOT Do
Remote Device Control does not provide synchronised multi-room audio playback like Sonos, AirPlay 2, or Chromecast Audio groups. It does not:
- Synchronise audio timing across multiple devices
- Create playback groups where multiple speakers play simultaneously
- Handle clock synchronisation between devices
- Buffer audio to maintain sync across rooms
What it does do:
- Lets you remotely control playback on another device
- Shows you what's playing on that device in real-time
- Allows you to manage queues, skip tracks, adjust volume on the remote device
- Only the remote device plays audio — your controller device does not play along with it
Key Concepts
Two Ways to Control Playback
Llamafin supports two distinct remote control paradigms:
1. Jellyfin Sessions
- Uses Jellyfin's built-in
/SessionsAPI - Controls other Jellyfin clients on the same server
- No additional setup required beyond server connection
- Works with any Jellyfin-compatible client
2. Llamafin Connect (P2P)
- Direct device-to-device control between Llamafin instances
- Uses encrypted WebSocket communication
- Automatic device discovery on local network
- Enhanced security with end-to-end encryption
How Remote Control Works
The Flow:
- Discovery: Available sessions or devices are detected
- Selection: You choose which device/session to control
- Control: Your commands route to the selected target
- State Updates: Target device broadcasts playback status back to you
- Seamless Experience: Your UI shows accurate now-playing information regardless of target
Important: When you select a remote device as your playback target, all playback commands (play, pause, skip, etc.) are sent to that device. Your local device stops playing audio (if it was playing), and the remote device starts playing instead. This is not a grouped playback mode where both devices play together.
Security Model (Connect P2P)
End-to-End Encryption:
- All communication encrypted with AES-256-GCM (military-grade encryption)
- Keys exchanged using ECDH (Elliptic Curve Diffie-Hellman)
- No third-party servers involved - direct device-to-device only
Device Identity:
- Each device has a unique cryptographic identity
- Generated automatically on first use
- Stored securely in device keychain/keystore
Ownership Model:
- Only one controller can control playback at a time
- Any connected controller can claim ownership
- When owner disconnects, ownership is released
- Prevents conflicting commands from multiple controllers
Jellyfin Sessions
What Are Jellyfin Sessions?
Jellyfin sessions represent active playback instances on your Jellyfin server. When you're logged into a Jellyfin server, you can see and control any session that belongs to your user account.
Discovering Sessions
Automatic Detection:
- Sessions loaded when you log in
- Updates when other devices start/stop playback
- Shows only sessions you can control (your user account)
What You See:
- Device name (e.g., "Living Room TV", "Bedroom Speaker")
- Current playback status (playing, paused, stopped)
- Current track (if playing)
- Device type (TV, phone, desktop, etc.)
Controlling Sessions
Playback Commands:
| Command | What It Does |
|---|---|
| Play | Start playing selected track(s) |
| Pause | Pause current playback |
| Resume | Continue from paused position |
| Stop | Stop playback completely |
| Next Track | Skip to next track |
| Previous Track | Go back to previous track |
| Seek | Jump to specific position |
Advanced Commands:
| Command | What It Does |
|---|---|
| Set Volume | Adjust playback volume |
| Display Content | Show album/artist/playlist on target device |
| Send Message | Display message on target device |
User Management
Adding/Removing Users:
- Add other users to your session (collaborative listening)
- Remove users from session when needed
- Only session owner can manage users
Configuration
No Configuration Required:
- Sessions loaded automatically when you log in
- Updates dynamically as sessions change
- No manual setup needed
Llamafin Connect (P2P)
What is Llamafin Connect?
Llamafin Connect is a peer-to-peer remote control system built directly into Llamafin. It allows one Llamafin device to discover, pair with, and control another Llamafin device on the same local network.
Key Features:
- Automatic device discovery (no manual configuration)
- End-to-end encryption (ECDH + AES-256-GCM)
- Single-owner model (only one controller at a time)
- Auto-reconnect on connection loss
- Startup auto-reconnect to last-used device
Device Discovery
Automatic Discovery:
- Devices advertise themselves on local network via mDNS/Bonjour
- No manual IP entry required
- Updates in real-time as devices join/leave network
- Shows device name, type, and app version
What Gets Discovered:
- Other Llamafin devices on same WiFi network
- Device capabilities (audio playback, queue control)
- Encryption support status
Pairing Process
Secure Pairing:
- Select Device: Tap device from discovery list
- Handshake: Devices exchange cryptographic keys
- Verification: User identities matched for authorization
- Encryption: All future communication encrypted
- Control: You can now control the remote device
Security:
- ECDH (Elliptic Curve Diffie-Hellman) key exchange
- AES-256-GCM message encryption
- User identity verification during pairing
- Keys stored securely in device keychain/keystore
Ownership Model
Single Controller:
- Only one device can control playback at a time
- Prevents conflicting commands
- Any connected device can claim ownership
- When owner disconnects, control is released
Why Single Owner?:
- Prevents two controllers from playing different songs
- Clear responsibility for playback
- Simple to understand and manage
Configuration
Location: Settings → Connect (or Remote Control)
| Setting | Options | Description |
|---|---|---|
| Remote Control Enabled | Enabled/Disabled | Allows this device to be controlled by others |
| Use Remote Connection | Enabled/Disabled | Allows controlling other devices |
| Reconnect on Startup | Enabled/Disabled | Automatically reconnects to last-used target |
| Hashed User ID | Enabled/Disabled | Use hashed user ID for privacy during pairing |
When to Enable/Disable:
Enable Remote Control If:
- You want to control this device from another
- Using as a dedicated playback device
- Setting up remote control for dedicated speakers
Disable Remote Control If:
- Using device only for local playback
- Don't want others to control this device
- On a public or untrusted network
Remote Playback State
What is Remote Playback State?
When controlling a remote device, Llamafin maintains a parallel copy of that device's playback state. This allows your controller UI to show accurate now-playing information without overwriting your local player state.
What Gets Tracked
| Property | Description |
|---|---|
| Current Track | Track currently playing on remote device |
| Queue | Full queue contents on remote device |
| Playing Status | Whether remote is playing, paused, or stopped |
| Position | Current playback position (seconds) |
| Duration | Total track duration (seconds) |
| Volume | Remote device volume (0-100%) |
Why This Matters
Accurate UI:
- Controller shows exactly what's playing on remote device
- No polling or manual refresh needed
- Updates broadcast automatically every 500ms
- No difference in experience between local and remote control
Integration with Player
Playback Target Selection
How It Works:
Your player can switch between three playback targets:
- Local: Plays music on this device (default)
- Jellyfin Session: Sends commands to Jellyfin client
- Llamafin Connect Peer: Sends encrypted commands to peer device
Target Selection:
- UI shows which device is currently being controlled
- All player commands automatically route to selected target
- Queue management works identically for all targets
- No difference in user experience between targets
Note: When you select a remote device as your playback target, all playback commands (play, pause, skip, etc.) are sent to that device. Your local device stops playing audio (if it was playing), and the remote device starts playing instead. This is not a grouped playback mode where both devices play together.
Effective State Merging
Smart UI Updates:
The player uses "effective" selectors that merge local and remote state:
- Effective Current Track: Shows track from active target
- Effective Queue: Shows queue from active target
- Effective Playing Status: Shows status from active target
- Effective Position/Duration: Shows position from active target
This means your UI always shows accurate information regardless of playback target.
Use Cases
Home Remote Control
Scenario: You have Llamafin running on devices throughout your home
Setup:
- Enable Llamafin Connect on all playback devices
- Use your phone as the controller
- Discover and pair with any room's device
- Control playback from anywhere in the house
Benefits:
- Single control interface for all rooms
- No additional hardware needed
- Secure encrypted communication
- Accurate now-playing display
Note: This does not synchronise audio across rooms — you control one device at a time.
Party Control
Scenario: Friends want to control the music at a party
With Jellyfin Sessions:
- Everyone logged into same Jellyfin server
- Each person's device appears as a session
- Anyone can control their own session
- Host can control any session
With Llamafin Connect:
- Host device running as target (connected to stereo)
- Guests connect from their phones
- Whoever has ownership controls the queue
- Ownership passed around freely
Note: Only one person controls the music at a time (whoever has ownership). This is not a synchronised multi-room party setup.
Dedicated Playback Device
Scenario: You have a device always connected to your stereo system
Setup:
- Configure device as dedicated playback endpoint
- Enable Llamafin Connect remote control
- Control from your phone or tablet
- Phone becomes the remote, dedicated device becomes the target
Benefits:
- Phone battery preserved
- Better audio output from dedicated device
- Control from couch/bed/anywhere
- No need to touch the playback device
Multi-User Collaboration
Scenario: Multiple people want to manage the music queue together
How It Works:
- Host enables remote control
- Multiple users connect to host device
- Take turns claiming ownership
- Each person adds to queue when they own control
Benefits:
- Democratic music selection
- No passing around single device
- Everyone can see what's playing
- Fair turn-taking
Comparison: Jellyfin Sessions vs Llamafin Connect
| Feature | Jellyfin Sessions | Llamafin Connect |
|---|---|---|
| Discovery | Automatic via server | Automatic via mDNS |
| Encryption | Server-managed | End-to-end (ECDH + AES-256-GCM) |
| Control | Any Jellyfin client | Llamafin devices only |
| Multi-Controller | Yes (per-session) | No (single owner) |
| Queue Management | Limited | Full queue control |
| State Sync | Server-managed | Real-time (500ms) |
| Auto-Reconnect | No | Yes |
| Setup Required | None | Enable in settings |
| Synchronised Multi-Room Audio | ❌ No | ❌ No |
| What It Actually Does | Remote control of other Jellyfin clients | Remote control of other Llamafin devices |
When to Use Each:
Use Jellyfin Sessions When:
- Controlling other Jellyfin clients (TVs, other apps)
- Multiple users need to control their own sessions
- Server manages playback state
Use Llamafin Connect When:
- Controlling other Llamafin devices
- Need full queue management
- Want encrypted communication
- Need auto-reconnect and startup recovery
- Setting up dedicated playback devices
How Does This Compare to Sonos or Plexamp?
Llamafin's Remote Device Control is similar in concept to how Plexamp handles remote playback — it can control playback on other devices, but it does not synchronise audio across multiple speakers like Sonos does.
Sonos: True multi-room synchronised audio (multiple speakers play in perfect sync) Plexamp: Remote device control (control playback on other devices, one at a time) Llamafin: Remote device control (same as Plexamp — control other devices, not sync them)
If you need synchronised multi-room audio, you would need a dedicated multi-room audio system (Sonos, AirPlay 2, Chromecast Audio, etc.) and use Llamafin as a remote controller for those systems.
Synchronisation Mechanisms
Target-to-Controller State Broadcasting
How It Works:
- Target device monitors its playback state
- Every 500ms, broadcasts state updates
- Sends now-playing info and queue state
- Controller receives and updates UI
- All active sessions receive updates simultaneously
What Gets Broadcast:
- Current track information
- Playback status (playing, paused, stopped)
- Current position and duration
- Volume level
- Full queue contents
Controller-to-Target Command Routing
How Commands Flow:
- You press a button on controller (e.g., "Next")
- Command encrypted with session-specific key
- Sent via WebSocket to target device
- Target decrypts and validates command
- Ownership check ensures you're allowed to control
- Command executed on target device
- State update broadcasts back to controller
State Consistency Monitoring
Automatic Detection:
Llamafin monitors for state inconsistencies:
- Playback target says remote but remote not active
- Remote active but no Connect target
- Remote track exists but queue empty
If inconsistencies detected, warning logged for debugging.
Error Handling & Reliability
What Happens When Things Go Wrong
Target Device Goes Offline:
- WebSocket disconnect detected immediately
- Auto-reconnect attempts begin (exponential backoff)
- If target doesn't respond, controller gives up after 75 seconds
- Playback target reverts to "Local" mode
- User notified of disconnection
Session Becomes Unavailable:
- Session removed from available sessions list
- Commands fail with error message
- UI updates to show session unavailable
- Can select different session
Network Issues:
- Discovery waits for network to become available
- Auto-reconnect triggers when connectivity restored
- No commands lost - queued for replay when reconnected
Auto-Reconnect Strategy
Exponential Backoff:
| Attempt | Delay | Time Since Start |
|---|---|---|
| 1 | 5 seconds | 5 seconds |
| 2 | 10 seconds | 15 seconds |
| 3 | 20 seconds | 35 seconds |
| 4 | 40 seconds | 75 seconds |
Total Retry Window: 75 seconds Ping Before Re-pair: HTTP ping to verify target reachable Final Action: If all attempts fail, reverts to local playback
Self-Healing Features
- Automatic Reconnect: Exponential backoff reconnection
- Startup Recovery: Restores previous session on app launch
- Network Resilience: Waits for connectivity before retrying
- Graceful Degradation: Falls back to local playback if remote fails
- State Consistency: Parallel state prevents local/remote conflicts
Technical Specifications
| Specification | Jellyfin Sessions | Llamafin Connect |
|---|---|---|
| Protocol | HTTP REST API | WebSocket + AES-256-GCM |
| Discovery | Server /Sessions API | mDNS/Bonjour + UDP |
| Security | Jellyfin authentication | ECDH + AES-256-GCM |
| Ownership | Per-session control | Single owner model |
| State Updates | Server-managed | 500ms broadcast interval |
| Heartbeat | Server-managed | 5-second ping interval |
| Auto-Reconnect | No | Yes (75s total window) |
| Startup Reconnect | No | Yes (configurable) |
| Platform Support | All platforms | iOS, Android, Electron |
Troubleshooting
Sessions Not Appearing
Check:
- Logged into correct Jellyfin server
- Target device is actively playing content
- Target device belongs to your user account
- Server has sessions enabled and accessible
Devices Not Discovering Each Other (Connect)
Check:
- Both devices on same WiFi network
- Remote Control enabled on target device
- Firewall not blocking port 35811
- mDNS/Bonjour enabled on network
Commands Not Executing
Check:
- Target session/device still available
- You have ownership (for Connect)
- Network connectivity stable
- Target device not in error state
State Out of Sync
Try:
- Wait 1-2 seconds for next broadcast update
- Check network connectivity
- Verify target device actually playing expected content
- Reconnect to session/device if needed
Expected Behaviour Clarification:
- When controlling a remote device, only that device plays audio
- Your controller device does not play audio simultaneously
- This is intentional — Llamafin does not support synchronised multi-room playback
Related Documentation
- Authentication - User identity and security
- Network Management - Network connectivity monitoring
- Player & Queue - Playback target integration
- Settings System - Remote control configuration