High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
fix(mobile): stop playing video when dismissing on iOS (#31772)
Adam Gastineau3c3db5d0af7c
diff --git a/mobile/lib/presentation/widgets/asset_viewer/video_viewer.widget.dart b/mobile/lib/presentation/widgets/asset_viewer/video_viewer.widget.dartindex 4d56ca4c8a..ebf7fe7f5b 100644--- a/mobile/lib/presentation/widgets/asset_viewer/video_viewer.widget.dart+++ b/mobile/lib/presentation/widgets/asset_viewer/video_viewer.widget.dart@@ -316,12 +316,17 @@ class NativeVideoViewerState extends ConsumerState<NativeVideoViewer> with WidgeWidget build(BuildContext context) {final isCasting = ref.watch(castProvider.select((c) => c.isCasting));final status = ref.watch(videoPlayerProvider(widget.asset.id).select((v) => v.status));+ // https://github.com/flutter/flutter/issues/97499: iOS platform views are only disposed in frames containing platform views, or on+ // the first frame after a platform view disappears. Animating this view away uses those disappearing frames. Instead, forcibly remove+ // the view from the tree when we start a route transition, which has the side effect of properly ordering the `dispose`+ final isRouteActive = ModalRoute.of(context)?.isActive ?? true;+ final showPlayer = !isCasting && isRouteActive;return IgnorePointer(child: Stack(children: [- if (!_isVideoReady || widget.asset.isMotionPhoto || isCasting) Positioned.fill(child: widget.image),- if (!isCasting) ...[+ if (!_isVideoReady || widget.asset.isMotionPhoto || !showPlayer) Positioned.fill(child: widget.image),+ if (showPlayer) ...[Visibility.maintain(visible: _isVideoReady,child: NativeVideoPlayerView(onViewReady: _initController),