Skip to main content

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 /Sessions API
  • 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:

  1. Discovery: Available sessions or devices are detected
  2. Selection: You choose which device/session to control
  3. Control: Your commands route to the selected target
  4. State Updates: Target device broadcasts playback status back to you
  5. 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:

CommandWhat It Does
PlayStart playing selected track(s)
PausePause current playback
ResumeContinue from paused position
StopStop playback completely
Next TrackSkip to next track
Previous TrackGo back to previous track
SeekJump to specific position

Advanced Commands:

CommandWhat It Does
Set VolumeAdjust playback volume
Display ContentShow album/artist/playlist on target device
Send MessageDisplay 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:

  1. Select Device: Tap device from discovery list
  2. Handshake: Devices exchange cryptographic keys
  3. Verification: User identities matched for authorization
  4. Encryption: All future communication encrypted
  5. 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)

SettingOptionsDescription
Remote Control EnabledEnabled/DisabledAllows this device to be controlled by others
Use Remote ConnectionEnabled/DisabledAllows controlling other devices
Reconnect on StartupEnabled/DisabledAutomatically reconnects to last-used target
Hashed User IDEnabled/DisabledUse 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

PropertyDescription
Current TrackTrack currently playing on remote device
QueueFull queue contents on remote device
Playing StatusWhether remote is playing, paused, or stopped
PositionCurrent playback position (seconds)
DurationTotal track duration (seconds)
VolumeRemote 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:

  1. Local: Plays music on this device (default)
  2. Jellyfin Session: Sends commands to Jellyfin client
  3. 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:

  1. Enable Llamafin Connect on all playback devices
  2. Use your phone as the controller
  3. Discover and pair with any room's device
  4. 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:

  1. Configure device as dedicated playback endpoint
  2. Enable Llamafin Connect remote control
  3. Control from your phone or tablet
  4. 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:

  1. Host enables remote control
  2. Multiple users connect to host device
  3. Take turns claiming ownership
  4. 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

FeatureJellyfin SessionsLlamafin Connect
DiscoveryAutomatic via serverAutomatic via mDNS
EncryptionServer-managedEnd-to-end (ECDH + AES-256-GCM)
ControlAny Jellyfin clientLlamafin devices only
Multi-ControllerYes (per-session)No (single owner)
Queue ManagementLimitedFull queue control
State SyncServer-managedReal-time (500ms)
Auto-ReconnectNoYes
Setup RequiredNoneEnable in settings
Synchronised Multi-Room Audio❌ No❌ No
What It Actually DoesRemote control of other Jellyfin clientsRemote 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:

  1. Target device monitors its playback state
  2. Every 500ms, broadcasts state updates
  3. Sends now-playing info and queue state
  4. Controller receives and updates UI
  5. 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:

  1. You press a button on controller (e.g., "Next")
  2. Command encrypted with session-specific key
  3. Sent via WebSocket to target device
  4. Target decrypts and validates command
  5. Ownership check ensures you're allowed to control
  6. Command executed on target device
  7. 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:

AttemptDelayTime Since Start
15 seconds5 seconds
210 seconds15 seconds
320 seconds35 seconds
440 seconds75 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

SpecificationJellyfin SessionsLlamafin Connect
ProtocolHTTP REST APIWebSocket + AES-256-GCM
DiscoveryServer /Sessions APImDNS/Bonjour + UDP
SecurityJellyfin authenticationECDH + AES-256-GCM
OwnershipPer-session controlSingle owner model
State UpdatesServer-managed500ms broadcast interval
HeartbeatServer-managed5-second ping interval
Auto-ReconnectNoYes (75s total window)
Startup ReconnectNoYes (configurable)
Platform SupportAll platformsiOS, Android, Electron

Troubleshooting

Sessions Not Appearing

Check:

  1. Logged into correct Jellyfin server
  2. Target device is actively playing content
  3. Target device belongs to your user account
  4. Server has sessions enabled and accessible

Devices Not Discovering Each Other (Connect)

Check:

  1. Both devices on same WiFi network
  2. Remote Control enabled on target device
  3. Firewall not blocking port 35811
  4. mDNS/Bonjour enabled on network

Commands Not Executing

Check:

  1. Target session/device still available
  2. You have ownership (for Connect)
  3. Network connectivity stable
  4. Target device not in error state

State Out of Sync

Try:

  1. Wait 1-2 seconds for next broadcast update
  2. Check network connectivity
  3. Verify target device actually playing expected content
  4. 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