Skip to main content

## play_selection_on_remote

# Function play_selection_on_remote

Source

    async fn play_selection_on_remote(
        controller: &PlayerController,
        session_id: &str,
        media_items: &[MediaItem],
        start_index: usize,
    ) -> Result<(), String>

Expand description

Start a freshly-built queue on the active remote session.

Used by the “play tracks”/“play album track” commands when we’re in remote mode: instead of starting local MPV playback, we cast the selected tracks to the remote device. Mirrors PlaybackModeManager::transfer_to_remote’s play_on_session call, but for a brand-new selection (so there’s no resume position - playback starts from the chosen track’s beginning).

Local-only items (no Jellyfin ID) can’t be cast, so they’re filtered out and the start index is adjusted to the remaining Jellyfin items. Returns an error if the selected track itself has no Jellyfin ID.