Skip to content

feat: Jellyfin SyncPlay support#735

Open
irican-f wants to merge 6 commits into
DonutWare:developfrom
irican-f:syncplay
Open

feat: Jellyfin SyncPlay support#735
irican-f wants to merge 6 commits into
DonutWare:developfrom
irican-f:syncplay

Conversation

@irican-f

@irican-f irican-f commented Feb 3, 2026

Copy link
Copy Markdown

Pull Request Description

Adds Jellyfin SyncPlay support so users can watch media together in sync across devices.

  • Backend: WebSocket connection to Jellyfin for real-time commands; REST API for group create/join/leave, pause/unpause, seek, buffering/ready; NTP-like time sync for command scheduling; duplicate command handling and buffering-aware playback.
  • UI: SyncPlay FAB and badge in the app shell; bottom sheet to create/join/leave groups and see participants; command indicator (syncing pause/play/seek); native Android command overlay when using the native player.
  • Lifecycle: Reconnect WebSocket and rejoin group on app resume (mobile); Web skipped for background behavior.
  • L10n: English and French for all SyncPlay strings.
  • Docs: docs/syncplay-implementation.md documents the protocol and architecture.

Issue Being Fixed

Feature request: SyncPlay support for watching together with other Jellyfin clients.

Screenshots / Recordings

  • Screenshot of SyncPlay FAB and group sheet
  • Screenshot of command indicator (e.g. "Syncing pause...") during sync
  • (Optional) Short recording: join group from two devices, pause/unpause/seek in sync
image image image image image image image
fladder_syncplay_demo_beta_compressed.mp4

Checklist

  • If a new package was added, did you ensure it works for all supported platforms? Is the package well maintained
    (Added: web_socket_channel ^3.0.3 — used for SyncPlay WebSocket. pub.dev; cross-platform.)
  • Check that any changes are related to the issue at hand.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to move these callbacks to the ExoPlayer and listen to state changes from the player itself.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here I'm not even sure we need to use these callbacks.

The player already reports back it's state to flutter we could probably use that for reporting seek/pause/play states. That way we don't rely on any additional kotlin implementation.

modifier: Modifier = Modifier
) {
val syncPlayState by VideoPlayerObject.syncPlayCommandState.collectAsState()
val visible = syncPlayState.processing && syncPlayState.commandType != null

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will recalculate whenever the state changes. Probably fine for a small composable but lets change this to

Suggested change
val visible = syncPlayState.processing && syncPlayState.commandType != null
val visible by remember(syncPlayState) {
derivedStateOf {
syncPlayState.processing && syncPlayState.commandType != null
}
}

Translate(
callback = { cb ->
when (syncPlayState.commandType) {
"Pause" -> Localized.syncPlayCommandPausing(cb)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a enum for this. Pigeon supports enum's that way both flutter/kotlin are in sync and we don't rely on Strings.

}

// SyncPlay command state for overlay
data class SyncPlayCommandState(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put this in pigeon.

key: const Key("Search"),
onPressed: () => context.router.navigate(LibrarySearchRoute()),
child: const Icon(IconsaxPlusLinear.search_normal_1),
);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the position of this widget. Let's remove it from the dashboard for now.
We should not be using multiple fabs together in a single navigation rail.

We'll have to find a better spot.

final isProcessing = ref.watch(syncPlayProvider.select((s) => s.isProcessingCommand));
final processingCommand = ref.watch(syncPlayProvider.select((s) => s.processingCommandType));

final (icon, color) = switch (groupState) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extension please.


String _getProcessingText(BuildContext context, String? command) {
return switch (command) {
'Pause' => context.localized.syncPlaySyncingPause,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is re-used quite a lot just adding a reminder to replace this with the enum and extension method.

_loadGroups();
}

Future<void> _loadGroups() async {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be cleaner to lift this state out of the widget and put it in a provider.

Comment thread pubspec.yaml Outdated
flutter_native_splash: ^2.4.7
macos_window_utils: ^1.9.0

web_socket_channel: ^3.0.3

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move it to "# Network and HTTP" group.

@PartyDonut PartyDonut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First of thanks for implementing this, pretty big PR. But something a lot of people where requesting 👍🏼.

Works pretty well for the most part, some notes/quirks though. These are some initial findings will have to go over it after some changes.

About the UI itself. I left some comments about UI choices. However I will probably go over it myself to make some changes to bring it more in line with Fladder as it currently is.

UX:
We should show a loading indicator when any of the users press a play button. Now it has to load for a bit before the playback starts because Fladder is still synchronising.

When a player “stops” playback should all other participants return to the previous screen as well?

Architecture:
Currently most of the calls inside of the.UI go to videoplayerprovider but it now either calls the original player.pause or a new syncprovider.pause.
Like mentioned in the comments it would be better to listen to the players state stream and adjust everything based on that.

Bugs:
Playback stops working when syncplay becomes out of sync. Leaving/creating a group does nothing to change this state.
Fladder starts playback and finishes loading the video but it remains in a “paused” state as if it’s awaiting the syncplay to synchronize.

Sometimes “play” commands seem to not propagate to other users

@PartyDonut

Copy link
Copy Markdown
Collaborator

Also mentioned in some comments. But there is a lot of re-formatting making it difficult to review the changes.

Please re-format all files using the .vscode/settings.json. The biggest issue being the 120 line length currently not being used in your formatter.

@PartyDonut PartyDonut added the feature New feature or request label Feb 3, 2026
@fmrozvezev

Copy link
Copy Markdown

Hi! What's the status of this PR? Are the fixes discussed above still needed, or has everything been fixed?

I'm curious because I'm really looking forward to this feature. Thanks for such a great app!

@irican-f

irican-f commented Mar 10, 2026

Copy link
Copy Markdown
Author

Hi !
I'll push the last remaining fixes soon and do some tests on different devices again before requesting a new review

@BlackShadeOSS

Copy link
Copy Markdown

I you need someone to test it out I can help.

@irican-f

irican-f commented Mar 22, 2026

Copy link
Copy Markdown
Author

I've pushed the fixes and added sync correction (SpeedToSync and SkipToSync) that mirrors the behavior of the syncplay plugin on the official jellyfin-web.

@PartyDonut I did not change the added UI for the syncplay. If you have an idea of how it should look I can implement it or we can merge this PR to another branch where you can make the UI changes

@irican-f irican-f requested a review from PartyDonut March 22, 2026 21:23
@PartyDonut

Copy link
Copy Markdown
Collaborator

Thanks for the improvements, had a quick test it does seem more stable then previously.

I will have a closer look next week.
A few small things I noticed now.

When we are in a group and the users presses play nothing really happens, however in the background it is starting the playback. We should show a "loading" overlay/pop-up for all the people in that group so users don't start pressing play multiple times.

Can we also have a "user has joined" pop-up. Currently the groups creator does not see a message.

If any of the users stops playback the other users keep on viewing is this the intended behavior? If yes should a user be able to join back?

About the UI, it's fine to leave it as is when you are done with your work on the PR I will just merge this and create a new PR for easier reviewing.

@fmrozvezev

Copy link
Copy Markdown

Hi! I built a build based on this PR and noticed the following:

The next episode switcher isn't working correctly. When I press the button to start an episode, it starts right at the end of the timeline.

Sometimes, after pausing and unpausing, someone in the group gets kicked out and has to rejoin, but there's no notification about leaving the group.

Do you need any examples from me in the form of screenshots, screen recordings, or logs?

The server logs show nothing unusual, but the client logs only show errors, which are also blank.

@PartyDonut PartyDonut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late response, have been a bit busy. Also sorry about the merge conflicts quite a lot of re-work needed to get music working.

I took a quick glance through the files, at this point there is no way for me to properly review this PR.

There are a lot of files that are marked as changed but are not related to the PR at hand (might be because of the music re-work?), at this point the best path forward would be to re-base it on develop make sure all the changes are related to the sync-play functionality.

@JenteJan

JenteJan commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

While testing this branch I hit a bug: starting playback from Fladder in a SyncPlay group didn't start it on the official clients — TV episodes never started (movies did), and "Continue Watching" restarted the group from 0:00. Verified against both the official Jellyfin web client and the LG webOS app.

Root cause: _playSyncPlay sends a single-item queue, but the official client always queues the whole series (with PlayingItemPosition at the chosen episode) — a lone single-episode queue isn't started by official clients. Movies are single-item by nature, so they worked and hid the bug. The resume position was also dropped, since the SyncPlay path never resolved model.startDuration() the way the local playback path does.

Fix: I opened a PR against the syncplay branch — irican-f#2 — mirroring the local path: build the queue via collectQueue (full series for an episode/series/season, single item for a movie), resolve Series/Season → next-up episode, send the whole series with the correct playingItemPosition, and fall back to the resolved item's saved resume position. Feel free to merge or cherry-pick it.

JenteJan added a commit to JenteJan/Fladder that referenced this pull request Jun 8, 2026
Removes generated-file drift so the PR diff shows only SyncPlay-related
changes (per maintainer review on DonutWare#735). Non-SyncPlay generated files
(account/credentials/boxset/etc.) now match develop and drop out of the diff.
JenteJan added a commit to JenteJan/Fladder that referenced this pull request Jun 8, 2026
Revert files that syncplay only reformatted (import order, wrapping,
blank lines) with no functional change, so the PR diff contains only
SyncPlay-related changes (per maintainer review on DonutWare#735).
@irican-f

irican-f commented Jun 28, 2026

Copy link
Copy Markdown
Author

Thanks for the feedback. You were right that the diff was unreviewable. I've rebased onto the current develop and stripped everything back to SyncPlay-only changes.

  • Rebased onto the latest develop, resolving conflicts against the recent rework.
  • The bulk of the noise was generated-file churn (*.freezed.dart, *.g.dart, *.mapper.dart, the Swagger client) my branch had regenerated them against an older base, so they showed up as unrelated changes. I've regenerated everything cleanly on top of develop, so only the generated files that SyncPlay actually owns remain.
  • Dropped a handful of incidental, non-SyncPlay edits (whitespace/reformatting) that had crept in.
  • Restructured the work into 6 logical commits (models + Pigeon, providers/websocket, player/wrappers, UI, native Android, l10n/tests/docs) to make review easier.

Happy to split further or adjust anything if it helps the review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants