Skip to content

Play torrent sources through the existing player - #3

Merged
jkrishna289 merged 1 commit into
mainfrom
feat/torrent-source-streaming
Aug 7, 2026
Merged

jkrishna289 merged 1 commit into
mainfrom
feat/torrent-source-streaming

Conversation

@jkrishna289

Copy link
Copy Markdown
Owner

Lets a title that is not in the library be streamed from a torrent source and played immediately. Requires Orca Engine 1.0.14.1 with FeatureSourceStreaming enabled.

The seam

PlaybackViewModel already had a branch for a remote MediaSourceInfo carrying a raw URL — Jellyfin's own representation of a source it does not manage. Synthesising one of those for a torrent stream means the existing Media3 pipeline, track selection, seek bar, controls and overlay all work untouched.

No second player, and no custom DataSource: that would have been ExoPlayer-only and silently broken the MPV backend.

Design rules made structural

  • Never encourages sources over the library. Request stays first-focused; Find Sources is a later item and disappears once a title is available.
  • No implicit searching. The only automatic call asks the server which features it offers. Browsing has no path to an indexer.
  • No dead ends. A dead source reopens the ranked list; retry is only offered where retrying can help.
  • No jargon by default. At most five labelled choices; release names, share counts and indexer names sit behind "Show details".

Verified on device

Streamed a torrent end to end on a TV emulator against a live server: first frame rendered via DirectPlay, position advanced, seeks to 181s and 212s landed and resumed, and the seek bar showed the true 14:48 runtime from server-side ffprobe.

Not included

  • Series/episodes — movies only; the new params default off so DiscoverSeriesDetails is unchanged
  • Client-side session close — the server's idle sweep covers correctness
  • "Keep in Library" — streaming and downloading stay separate, as intended

🤖 Generated with Claude Code

A title that is not in the library can now be streamed from a torrent source
and played immediately. The player does not know where the bytes came from.

The whole design turns on one seam: PlaybackViewModel already had a branch for
a remote MediaSourceInfo carrying a raw URL, which is how Jellyfin represents a
source it does not manage. Synthesising one of those for a torrent stream means
the existing Media3 pipeline, track selection, seek bar, controls and overlay
all work untouched. No second player, and no custom DataSource — that would
have been ExoPlayer-only and silently broken the MPV backend.

TorrentMediaSource is the single place that synthesis happens, so if a neutral
PlaybackSource abstraction is ever warranted there is one seam to change.
Deliberately not built yet: two implementations where one is a thin adapter
does not justify refactoring StreamChoiceService and QualityManager.

The picker offers at most five labelled choices, deduplicated by source id
because the same release is often best on several axes. The full ranked list is
behind "Show all sources", and release names, share counts and indexer names
only appear behind "Show details" — no viewer needs to read the word "seeder".

Request stays the first-focused action; finding sources is a later item in the
row and disappears entirely once a title is available, so the library route is
always the encouraged one. Nothing searches implicitly: the only automatic call
asks the server which features it offers, and browsing has no path to an
indexer.

Failure states are all recoverable. A dead source reopens the ranked list
rather than dropping the viewer back on the details page, and retry is only
offered where retrying can help.

Torrent playback deliberately skips watch-activity reporting, resume
persistence and next-up, since those are keyed on a real Jellyfin item id that
a one-off stream does not have.

Source search and session-open each get their own long-timeout HTTP client. The
shared 30s read bound cut both off mid-flight: a cold indexer sweep takes tens
of seconds, and opening a session has to fetch torrent metadata from peers and
prebuffer before it can answer.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jkrishna289
jkrishna289 merged commit c8bb17a into main Aug 7, 2026
1 of 2 checks passed
jkrishna289 added a commit that referenced this pull request Sep 11, 2026
Play torrent sources through the existing player
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant