From b8648426f8602e7c43ed06ebd84f2f012cd1f49e Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Thu, 2 Jul 2026 17:23:26 -0400 Subject: [PATCH] fix(video): keep native player alive across rotation (#575) Wrap the native player in a GlobalKey so an orientation change re-parents the existing platform view instead of tearing it down and reloading the stream. Co-authored-by: Claude Opus 4.8 (1M context) --- lib/screens/channel/channel.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/screens/channel/channel.dart b/lib/screens/channel/channel.dart index d1469988..c66dae36 100644 --- a/lib/screens/channel/channel.dart +++ b/lib/screens/channel/channel.dart @@ -312,7 +312,14 @@ class _VideoChatState extends State final player = GestureDetector( onLongPress: _videoStore.handleToggleOverlay, child: _videoStore is NativeVideoStore - ? NativeVideo(nativeVideoStore: _videoStore) + ? NativeVideo( + // GlobalKey so the native platform view is *reparented* (not + // rebuilt) across the portrait↔landscape layout swap — without + // it, rotating destroys and recreates the player, forcing a + // reload. Mirrors the WebView Video below. + key: _videoKey, + nativeVideoStore: _videoStore, + ) : Video( key: _videoKey, videoStore: _videoStore as VideoStore,