Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix(photos): start memory progress with video playback

ashilkn395ae275371b
diff --git a/mobile/apps/photos/changes/memory-video-progress.md b/mobile/apps/photos/changes/memory-video-progress.md
new file mode 100644
index 0000000000..5d130a9d8e
--- /dev/null
+++ b/mobile/apps/photos/changes/memory-video-progress.md
@@ -0,0 +1 @@
+- Fixed memory progress remaining paused when a video starts playing.
diff --git a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
index b3b737d327..221f2a24c5 100644
--- a/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
+++ b/mobile/apps/photos/lib/ui/home/memories/full_screen_memory.dart
@@ -358,7 +358,9 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
// Tokenises a pending zoom-start so a newer onFinalFileLoad cleanly
// invalidates the prior delayed forward.
Object? _kenBurnsStartToken;
- bool _isAnimationPaused = false;
+ bool _isViewerPaused = false;
+ bool _isPlaybackPaused = false;
+ bool get _isAnimationPaused => _isViewerPaused || _isPlaybackPaused;
bool _isMediaZoomed = false;
final _socialControlsVisible = ValueNotifier<bool>(false);
@@ -433,16 +435,24 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
void _toggleAnimation({required bool pause}) {
if (!mounted) return;
- _isAnimationPaused = pause;
- if (pause) {
+ _isViewerPaused = pause;
+ _syncAnimationState();
+ }
+
+ void _togglePlaybackAnimation({required bool pause}) {
+ if (!mounted) return;
+ _isPlaybackPaused = pause;
+ _syncAnimationState();
+ }
+
+ void _syncAnimationState() {
+ if (_isAnimationPaused) {
_progressAnimationController?.stop();
_zoomAnimationController?.stop();
- } else {
- if (hasFinalFileLoaded || isAtFirstOrLastFile) {
- _progressAnimationController?.forward();
- if (_kenBurnsStartToken == null) {
- _zoomAnimationController?.forward();
- }
+ } else if (hasFinalFileLoaded || isAtFirstOrLastFile) {
+ _progressAnimationController?.forward();
+ if (_kenBurnsStartToken == null) {
+ _zoomAnimationController?.forward();
}
}
}
@@ -484,6 +494,7 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
void onFinalFileLoad(int duration) {
if (!mounted) return;
+ _isPlaybackPaused = false;
hasFinalFileLoaded = true;
isAtFirstOrLastFile = false;
final memoryDuration = Duration(seconds: duration);
@@ -711,7 +722,16 @@ class _FullScreenMemoryState extends State<FullScreenMemory> {
_isMediaZoomed = isZoomed;
},
playbackCallback: (shouldEnable, _) {
- _toggleAnimation(pause: !shouldEnable);
+ final activeIndex = _clampedMemoryIndex(
+ inheritedData.indexNotifier.value,
+ inheritedData.memories.length,
+ );
+ if (activeIndex == null ||
+ inheritedData.memories[activeIndex].file !=
+ currentFile) {
+ return;
+ }
+ _togglePlaybackAnimation(pause: !shouldEnable);
},
onFinalFileLoad: ({required int memoryDuration}) {
final activeIndex = _clampedMemoryIndex(