From e586360e39798eea2e55f6fc1a822eb91960dfc7 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Tue, 10 Feb 2026 06:30:33 +0100 Subject: [PATCH] fix: watch together same-episode replay blocked --- .../providers/watch_together_provider.dart | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/watch_together/providers/watch_together_provider.dart b/lib/watch_together/providers/watch_together_provider.dart index e978464b..097413e7 100644 --- a/lib/watch_together/providers/watch_together_provider.dart +++ b/lib/watch_together/providers/watch_together_provider.dart @@ -486,6 +486,19 @@ class WatchTogetherProvider with ChangeNotifier { appLogger.d('WatchTogether: Host exited player, callback set: ${onHostExitedPlayer != null}'); + // Clear media info so the next mediaSwitch (even same ratingKey) isn't + // treated as a duplicate by the guard in _handleMediaSwitch. + // copyWith uses ?? so it can't set fields to null — construct directly. + _session = WatchSession( + sessionId: _session!.sessionId, + role: _session!.role, + controlMode: _session!.controlMode, + state: _session!.state, + participants: _session!.participants, + errorMessage: _session!.errorMessage, + hostPeerId: _session!.hostPeerId, + ); + // Clear the player callback BEFORE popping so that any mediaSwitch message // arriving during the pop animation routes to MainScreen's handler instead // of the dying VideoPlayerScreen.